|
Boost : |
Subject: Re: [boost] Mutex vs Semaphore
From: Dmitry Goncharov (dgoncharov_at_[hidden])
Date: 2009-04-03 06:27:37
Jean-Sebastien Stoezel wrote:
> Thanks for the quick reply. Using conditon variables sounds quite
> heavy. You need to instantiate a mutex, a condition variable and a
> flag...
> Would there be anything wrong with instantiating a semaphore from the
> interprocess library to provide inter-thread synchronization?
You can use a semaphore from the interprocess library to provide
inter-thread synchronization.
An interprocess semaphore is a thin wrapper around a posix semaphore if
BOOST_INTERPROCESS_POSIX_SEMAPHORES is defined.
Otherwise, a semaphore is emulated with a mutex and a condvar.
> By the way, why isn't there any semaphore available in the thread
> library?
>
The boost.Crypto library is going to provide some.
BR, Dmitry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk