|
Boost Users : |
Subject: Re: [Boost-users] [asio] Crash when posted handlers execute in one thread only?
From: Sohail Somani (sohail_at_[hidden])
Date: 2014-04-10 14:45:45
On 2014-04-07, 5:12 PM, Igor R wrote:
>>> Does it still crash if you remove the call to service.stop()? Because
>>> in the code below, that should be redundant.
>>>
>>> Also, starting the threads should occur *after* you post all the tasks.
>>> Otherwise there is a chance that none of them will actually execute.
>>
>>
>> Thanks for your comments.
>>
>> As Igor pointed out in another email, without a call to service.stop(), the io_service will continue to wait for more handlers which means the group.join_all() will continue to wait uninterrupted until the Sun finally explodes.
>
> Just out if curiosity, if you create io_service::work dynamically and
> destroy it instead of stopping io_service, does it crash?
> Like this:
> auto work = make_shared<io_service::work>(service);
> //....
> // at the point where you want to stop the service:
> work.reset();
With this change, it crashes once every two runs of the test app so it
crashes less often, but still crashes reliably. Seems like a bug to me
and not the PEBKAC for which I am infamous. Anyone familiar enough with
the asio library to say that I should file a bug?
Thanks,
Sohail
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