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] Don't do lock elision on an error checking mutex (bug 17514)


On 01/14/2016 10:40 AM, Andreas Schwab wrote:
> +  pthread_mutexattr_init (&mutexattr);
> +  pthread_mutexattr_settype (&mutexattr, PTHREAD_MUTEX_ERRORCHECK_NP);
> +
> +  pthread_mutex_init (&mutex, &mutexattr);
> +  pthread_mutexattr_destroy (&mutexattr);
> +
> +  pthread_mutex_timedlock (&mutex, &tms);
> +  /* The preceding call to pthread_mutex_timedlock erroneously enabled
> +     lock elision on the mutex, which triggered an assertion failure
> +     during unlock.  */

This comment is confusing because it temporal relationship is unclear
(past execution vs. past versions of glibc).

> +  pthread_mutex_unlock (&mutex);

Please add error checking for all the return values.  I believe the
error-checking mutex will give you a consistent result here.

Florian


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