[En-Nut-Discussion] Feature Request 1572837: mutex API nesting level info

Nathan Moore nategoose at gmail.com
Mon Jul 14 17:38:29 CEST 2008


> Why not use a Semaphore? I understand that it is basicaly a counter,
> just as needed.

That counter is counting a different thing.  Semaphores allow some settable
number of callers to enter at any given time but is not thread aware.
The recursive mutex is thread aware.  It only lets one thread lock the mutex
at any given time, but counts the number of times that that mutex does lock
and unlock.  Only when this counter is 0 can another thread get the lock.
You can't do this with semaphores.

Nathan



More information about the En-Nut-Discussion mailing list