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 5/9] Support setting elision in pthread_mutexattr_settype


On 05/10/2013 06:42 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> 2013-05-02 Andi Kleen  <ak@linux.intel.com>
> 
> 	* pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
>         Support elision flags.
> ---
>  nptl/pthread_mutexattr_settype.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/nptl/pthread_mutexattr_settype.c b/nptl/pthread_mutexattr_settype.c
> index 7b476e9..cd4cec8 100644
> --- a/nptl/pthread_mutexattr_settype.c
> +++ b/nptl/pthread_mutexattr_settype.c
> @@ -26,8 +26,11 @@ __pthread_mutexattr_settype (attr, kind)
>       int kind;
>  {
>    struct pthread_mutexattr *iattr;
> +  int mkind = kind & ~PTHREAD_MUTEX_ELISION_FLAGS_NP;
>  
> -  if (kind < PTHREAD_MUTEX_NORMAL || kind > PTHREAD_MUTEX_ADAPTIVE_NP)
> +  if (mkind < PTHREAD_MUTEX_NORMAL || mkind > PTHREAD_MUTEX_ADAPTIVE_NP)
> +    return EINVAL;
> +  if ((kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == PTHREAD_MUTEX_ELISION_FLAGS_NP)
>      return EINVAL;

Why is this invalid?

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

Cheers,
Carlos.


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