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

Alain M. alainm at pobox.com
Mon Jul 14 18:08:37 CEST 2008


Oi Andreas, essa resposta faz sentido para você? Ele afirma com muita 
propriedade que samafores não são "thread aware", existe isso???

(isso é na lista do NutOS, por isso é importante)
Alain

----------------
Why not use a Semaphore? I understand that it is basicaly a counter,
just as needed. I have already used mutexes implemented as semaphores
with a max count of 1...

Alain

Nathan Moore escreveu:
>> 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