[Bordeaux-threads-devel] Deprecating recursive locks

Antony lisp.linux at gmail.com
Thu May 3 07:00:37 UTC 2012


On 5/2/2012 1:57 PM, Vladimir Sedach wrote:
While what you say below I am sure is true, is it good enough to say 
recursive locking should be removed?
Trying to use the same mutex for normal locking and again as part of 
condition variable structure I think is breaking the abstraction of 
condition variable.
Also, if someone writes code that recursively locks to control access to 
a resource and then tries to do signalling deep in the call stack using 
that same mutex combined with a condition var, that's just bad code. 
Saying we shouldn't have recursive mutexes because of that is like 
saying we shouldn't have threads cause they can corrupt each others 
variables.

I do like this mail thread since I think it's good to discuss this. 
Sorry, I did not respond early enough.

-Antony

> Another argument against recursive locks that hasn't come up yet is
> that they fail very badly when used with condition variables. I think
> the fact that recursive locks aren't supported by most implementations
> plus the fact that they behave differently wrt condition variables on
> different implementations and operating systems are very good
> arguments for leaving recursive locks out of a portable threading
> library.
>
> Vladimir
>
>





More information about the bordeaux-threads-devel mailing list