This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Race unlocking-locking mutex


On 16/09/13 05:28, David Ahern wrote:
On 9/14/13 6:31 PM, Ángel González wrote:
Hmm, yes, it seems doable.
I think it could even be implemented without __prev_owner.

This may be such an implementation (to replace the nptl/lowlevellock.h
__generic_mutex_lock).

In my case I am not seeing this code path used. This is linux, x86_64 and from what I can see the code path is:
  pthread_mutex_lock == __pthread_mutex_lock()

In the latter you hit the 'simple:' goto path, and then LLL_MUTEX_LOCK which is a macro to lll_lock and that comes from nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h.

I can read asm well enough to get the gist of the code but I do not know asm near good enough to implement your suggestion below.

David

Sigh, I was convinced __pthread_mutex_lock() ended up calling __generic_mutex_lock. I may have confused LLL_MUTEX_LOCK() calls with lll_mutex_lock() :(


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]