Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Crash when posted handlers execute in one thread only?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-04-06 20:20:30

On 6/04/2014 02:49, quoth Sohail Somani:
> Not sure if there is a race condition in the code below, or if I am not
> stopping the service in a sanctioned manner but when run, the code
> consistently crashes on OSX 10.9 with Boost 1.55 and Clang. The only
> regular pattern was that the crash occurs when all the posted completion
> handlers execute in one thread only. When the completion handlers
> execute across both threads, there is no crash. This seems to me like
> there could be an initialization bug somewhere. I'll try and create a
> smaller test case.

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.

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