[PATCH][BZ #15790] Have pthread_mutexattr_gettype mask out the elision bit.

Cesar Philippidis cesar@codesourcery.com
Tue Oct 22 17:24:00 GMT 2013


This patch addresses the issue in BZ #15790. I'm not sure why
pthread_mutexattr_gettype is returning PTHREAD_MUTEX_NO_ELISION_NP,
since that seems to be an internal flag. Tolga Dalman's comment on BZ
suggests that PTHREAD_MUTEX_NO_ELISION_NP should be added to
PTHREAD_MUTEXATTR_FLAG_BITS. However, doing that may cause problems with
__pthread_mutex_init().

Is this patch OK?

Thanks,
Cesar
-------------- next part --------------
2013-10-22  Cesar Philippidis  <cesar@codesourcery.com>

	nptl/
	[BZ #15790]
	* pthread_mutexattr_gettype.c: Mask out internal references
	to PTHREAD_MUTEX_NO_ELISON_NP.

Index: nptl/pthread_mutexattr_gettype.c
===================================================================
--- nptl/pthread_mutexattr_gettype.c	(revision 422428)
+++ nptl/pthread_mutexattr_gettype.c	(working copy)
@@ -30,6 +30,10 @@ pthread_mutexattr_gettype (attr, kind)
 
   *kind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
 
+  /* Cannot distinguish between DEFAULT and NORMAL. So any settype
+     call disables elision for now. This accounts for that. */
+  *kind &= ~PTHREAD_MUTEX_NO_ELISION_NP;
+
   return 0;
 }
 weak_alias (pthread_mutexattr_gettype, pthread_mutexattr_getkind_np)


More information about the Libc-alpha mailing list