Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2005-08-30 16:52:36


I don't think you can do that with the thread lib. If you need to wait
until a thread is finished you can use the join().

You can of course keep the state somewhere else. Like:

enum teThreadState
{
  BLOCKED = 0,
  RUNNING,
  ...
}

teThreadState eState;

void run() throw()
{
  scoped_lock lock(mutex);
  
  eState = RUNNING;
  doSomething();

  eState = BLOCKED;

  while( condition )
    cond.wait( lock );

  eState = RUNNING;
}

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