Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-01-27 11:21:29


Lars Kunert wrote:
> Sorry, I have have shortened the code to some degree - taking the
> joins out. But the problem really seams to be in the constructor:
>
>> QueueError( ST max_queue_size =1000 )
>> : max_queue__size__( max_queue_size )
>> , thread_( Worker( this ))
>> {};

You're right, there's a problem in the constructor as well. Specifically,

> private:
> ST max_queue_size_;
> Queue queue_;
>
> Thread thread_;
>
> boost::mutex monitor_;
> boost::condition space_available_, job_available_;

thread_ is constructed before monitor_ and can end up trying to lock it
before its construction has completed.


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