Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Crash when posted handlers execute in one thread only?
From: Igor R (boost.lists_at_[hidden])
Date: 2014-04-07 17:12:24

>> 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:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at