Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2005-08-10 08:40:25

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

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 );


     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.


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