From: Maciej Sobczak (maciej_at_[hidden])
Date: 2003-06-05 12:11:23
Victor A. Wagner, Jr. wrote:
> I've also never actually _seen_ the implementation of a semaphore with a
> mutex and a condition variable, and don't readily envision it.
My university background considering synchronization was based on Modula
and some abstract course where semas and mutexes were used without
assuming that one is better than another.
My first real contact with multithreading was on M$ platform. Later,
I've found it quite convenient to have both given "on the plate" in the
M$ Windows API. This "convenience", mixed with my unbiased theoretical
background led me to this: when I started writing threaded programs on
Linux, all I missed was a semaphore object, in addition to the mutex.
Having mutex and condvar in the pthread library, I've implemented
semaphore on top of these two and later used only mutexes and semas in
the higher-level code.
Am I freak?
I will not bet my life that my implementation is correct in all aspects,
but the code using it never caused any problems (yes, I know -- that's
not a proof).
Having semas in the library would add some convenience for final users.
MHO, of course.
-- Maciej Sobczak http://www.maciejsobczak.com/ Distributed programming lib for C, C++, Python & Tcl: http://www.maciejsobczak.com/prog/yami/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk