This is the mail archive of the libc-alpha@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: [PATCH][BZ #15790] Have pthread_mutexattr_gettype mask out the elision bit.


On Tue, Oct 22, 2013 at 10:24:19AM -0700, Cesar Philippidis wrote:
> 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?
> 
Andi, it is unclear that if this is desired behaviour, one argument
againist could be that if user wants to clone mutex type like

int tp;
pthread_mutexattr_gettype(a1, &tp);
pthread_mutexattr_settype(a2, tp);

should it preserve elision or not?

> Thanks,
> Cesar

> 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;
> +

You should also mask PTHREAD_MUTEX_ELISON_NP.
>    return 0;
>  }
>  weak_alias (pthread_mutexattr_gettype, pthread_mutexattr_getkind_np)


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