Boost logo

Boost :

From: Pavel Cisler (pavel_at_[hidden])
Date: 2000-08-08 15:22:49

> A mutex is a synchronization object designed to allow mutually
> exclusive access to a resource.
> A semaphore is a synchronization object designed to allow access to a
> resource to a fixed number of owners. (This one needs work, but
> worded the way I did here it shows the distinction between a mutex
> and a semaphore).
> Issues such as re-entrancy (recursion) are an implementation detail,
> not actually part of the definition of the term.

As Steve already pointed out, these are hardly implementation details but
rather fundamental differences in behavior. If you use mutexes for anything
but the simplest synchronization, you will very much need to know which
"kind" you are dealing with to do your thread locking correctly.

One point I was making was that "fast" Pthread mutex behaves exactly like a
semaphore and therefore should be called that, calling it a mutex is
confusing and error prone.

This could of course be overcome by having a very clear definition of what
a "mutex" is in the new library. Given the fact that the name "mutex" is
overloaded and used for different locking primitives in different library
implementation, it might be better to come up with distinct names for the
different flavors.

There may be a clear, complete definition of what a "mutex" is in some
computer science text. (I haven't seen one in my stash of OS books). If
there is, I'm wrong and it would be a great name for the respective locking
primitive :-).


Boost list run by bdawes at, gregod at, cpdaniel at, john at