[En-Nut-Discussion] Feature Request 1572837: mutex API nesting level info
Alain M.
alainm at pobox.com
Mon Jul 14 21:43:22 CEST 2008
Hi,
I was checking with a friend who has a better understanding of those
matters:
Neither os us have eve known of a mutex that can be locled more than
once on the same thread just because the thread lock on the first atempt
if it is not available.
Also never heard of a Semaphore that is not thread-aware.
I was wrong about using Semaphores as counters, this is a non-standard use.
The "normal" way of controling re-entrancy is to have a mutex + a
counter, no standard simpler way. In Nut, NutEnterCritical() can be
lighter, but it may depend on the application.
My vote: use only what is standard and well known to every one. (This
has already been Nut's way for long...)
Alain
Przemek Rudy escreveu:
> Matthias Ringwald pisze:
>> ...
>> semaphore. Even more, a semaphore initialized to one cannot be aquired
>> a second time, even if its by the same thread. that's why the
>> recursive mutex is good for, it allows repeated locking by the same
>> thread.
> Yes, that is the reason...
>
> So I see just up to two questions that need to be answered:
> 1. If to follow posix or not:
> [yes] - do not change anything.
> [no]:
> 2. if the returned mutex counter is useful:
> [yes] - then change mutex code
> [no] - do not change anything.
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
More information about the En-Nut-Discussion
mailing list