|
Boost Users : |
From: Christian Henning (chhenning_at_[hidden])
Date: 2005-08-09 14:50:22
Hi there, I'm still working on the transistion from an old thread lib
to the boost thread lib.
I have two threads, the GUI thread and a worker thread. The worker
thread is always inside a loop that only breaks if someone set the
flag.
The GUI thread has from time to time to stop the worker thread. This
is currently done by setting a flag ( _bStop ) and the worker thread
will eventually stop like:
void run()
{
boost::mutex::scoped_lock oLock( _oRunMutex );
do
{
...
if( _bStop )
_oRunCondition.wait( oLock );
} while( _bTerminate == false );
}
I believe that this implemention can lead to deadlocks. But how can I
implement the behavior that the GUI thread will break until the worker
thread has stopped.
Thanks,
Christian
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