Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2003-06-05 12:17:36


Alexander Terekhov wrote:
> "Victor A. Wagner, Jr." wrote:
>
>>I'm baffled that they want to penalize (time and space) those for whom a
>>naked semaphore works. It's blatantly clear to anyone who's had to write a
>>mutex that it's additional code on TOP of a semaphore.
>
>
> Optimization stratergies aside (they are different for mutexes and
> semas) a binary semaphore can be used as "normal" POSIX mutex.

yes, binary semaphores may be implemented with a mutex (though I think
there is a subtle problem as POSIX mutex locks are owned, while
semaphores are not).

But binary semaphore are only a (small) subclass of semaphores, and I'd
use semaphores mostly to represent value *and* lock, where the value's
domain is larger than just 1/0.

Stefan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk