RE: [AD] Mini-synchronization API proposal for 4.1.x

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] Mini-synchronization API proposal for 4.1.x

> Recursive mutexi can be locked by a single thread multiple times (and
> then have to be unlocked that many times).  Non-recursive mutexi will
> deadlock the calling thread if you try that, but they are faster.

Do you mean that, if a mutex is already locked, the decision whether
to allow another lock depends on whether the would-be locker is the
thread that locked in the first place (in which case it is allowed),
or another thread (in which case it is blocked) ?
In this case, and if Allegro does not provide an API for creating
and using threads, but merely suggests using timers along with the
mutex API, then I do not see the need for such recursive mutexes,
as the caller will be the same thread, unless the program uses some
non Allegro thread API, in which case why not use the mutex API
offered by this thread API ? Is there anything I failed to take
into account ?
Also, it seems dodgy to me that a thread could lock multiple times
a mutex. What kind of uses are there for this ?

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/