Boost logo

Boost Users :

Subject: Re: [Boost-users] [ASIO] Access violation on io_service::work destructor
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-09-23 05:18:32


On 2010-09-23 10:51, Daniele Barzotti wrote:
> Hi,
>
> In my code I have a io_Service and a work object shared among my classes:
>

[snip]

>
>
> When my application ends and the io_service.run() returns I get:
>
> First-chance exception at 0x09299c18 (AxEuroATLib_debug.dll) in
> EuroSvr.exe: 0xC0000005: Access violation reading location 0xf0f0f0fc.
>
> at the following line (io_service.ipp):
>
> inline io_service::work::~work()
> {
> io_service_.impl_.work_finished();
> }
>
> I wrong something?
>
> Regards,
> Daniele

Besides a possible race in your statement

thread_started = !thread_started;

and some other bad stuff such as memory leaks when throwing an
exception, I don't see where the destructor of the work object is
called. Could you provide the code involved?

Rutger


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net