Boost logo

Boost :

Subject: Re: [boost] [threads] wait() and signal() ?
From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2009-10-07 12:41:18

Gottlob Frege wrote:
> If boost threads doesn't have a semaphore, we could add one.

boost::thread doesn't have a semaphore for a purpose.
boost::threads is modelled after the pthreads API, which does not
need what you are seeking for. Perhaps you could look up a book
on pthreads for an in depth explanation? For short in pthreads API the
state and the notification are decoupled, which is a more general

Of course you know it, but it is straight forward to get the
equivalent of a semaphore with boost::threads.

Something like (details omitted):

mutex mx;
int count = 42;
codition c;

    while (0==count) c.wait(mx);


Regards, Roland

  _  _  | Roland Schwarz aka. speedsnail
 |_)(_  | sip:speedsnail_at_[hidden]
 | \__) | mailto:roland.schwarz_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at