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 04/11] Support setting elision in pthread_mutexattr_settype


On 06/24/2013 02:24 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> 2013-06-18 Andi Kleen  <ak@linux.intel.com>
> 
> 	* pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
>         Support elision flags.
> ---
>  nptl/pthread_mutexattr_settype.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/nptl/pthread_mutexattr_settype.c b/nptl/pthread_mutexattr_settype.c
> index 7b476e9..92772e6 100644
> --- a/nptl/pthread_mutexattr_settype.c
> +++ b/nptl/pthread_mutexattr_settype.c
> @@ -26,8 +26,12 @@ __pthread_mutexattr_settype (attr, kind)
>       int kind;
>  {
>    struct pthread_mutexattr *iattr;
> +  int mkind = kind & ~PTHREAD_MUTEX_ELISION_FLAGS_NP;

Use PTHREAD_MUTEX_TYPE(kind)?

>  
> -  if (kind < PTHREAD_MUTEX_NORMAL || kind > PTHREAD_MUTEX_ADAPTIVE_NP)
> +  if (mkind < PTHREAD_MUTEX_NORMAL || mkind > PTHREAD_MUTEX_ADAPTIVE_NP)
> +    return EINVAL;
> +  /* Cannot set multiple flags.  */

Suggest:

/* Elision on/off flags conflict and can't both be set at the same time.  */

> +  if ((kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == PTHREAD_MUTEX_ELISION_FLAGS_NP)

Use PTHREAD_MUTEX_TYPE_ELISION(kind)?

>      return EINVAL;
>  
>    iattr = (struct pthread_mutexattr *) attr;
> 

This is all part of the second patchset and should get split out of
what we want to commit as a first patchset of non-ABI/non-API bits.

Cheers,
Carlos.


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