Subject: Re: [boost] Mutex vs Semaphore
From: Jean-Sebastien Stoezel (js.stoezel_at_[hidden])
Date: 2009-04-02 22:57:21
Thanks for the quick reply. Using conditon variables sounds quite
heavy. You need to instantiate a mutex, a condition variable and a
Would there be anything wrong with instantiating a semaphore from the
interprocess library to provide inter-thread synchronization? By the
way, why isn't there any semaphore available in the thread library?
On 2-Apr-09, at 9:25 PM, Sohail Somani wrote:
> Jean-Sebastien Stoezel wrote:
>> I need to synchronize 2 threads, that is once one is done doing
>> something, it should activate another thread that had been waiting
>> in a
>> pending state.
>> I see the thread library offers mutexes and nothing else. I guess
>> mutexes would do, but I do not believe I should use mutexes for my
>> application. Mutexes are supposed to provide mutual exclusion when
>> critical data is accessed. Semaphores should be used for what I
>> want to do.
> You can use condition variables for signalling:
> Sohail Somani
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk