This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 04/11] Support setting elision in pthread_mutexattr_settype
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: libc-alpha at sourceware dot org, Andi Kleen <ak at linux dot jf dot intel dot com>
- Date: Fri, 28 Jun 2013 01:24:01 -0400
- Subject: Re: [PATCH 04/11] Support setting elision in pthread_mutexattr_settype
- References: <1372098290-29147-1-git-send-email-andi at firstfloor dot org> <1372098290-29147-5-git-send-email-andi at firstfloor dot org>
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.