From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-06-04 16:34:19
Stefan Seefeld wrote:
> Alexander Terekhov wrote:
> > It is showing that semas (e.g. bin-semas aka "auto-reset events")
> > are really error-prone.
> you seem to equate microsoft's implementation of semaphores with
> the concept of semaphores (which is what I'd like to get feedback on).
No. I'm talking about the erroneous USE of a binary semaphore in
the Microsoft implementation of "metered section" silliness (which,
"conceptually" is nothing but a counting semaphore).
> If all that is wrong is that microsoft does a crappy job at implementing
> them, the response could be to provide a special implementation using
> mutexes and cv's *for the MS platforms*, and using native
> implementations when possible.
You don't need semaphores; neither binary nor counting semas are
needed for *threading*. Use mutexes for locking and condvars for
waiting. Modern semas are meant for things that need either async-
signal-safe "unlock" operation or memory isolation (no shared mem).
Threading has really nothing to do with that.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk