[COMMITTED] Make error checking effective in nptl/tst-cond25.c.
Commit Message
pthread_mutex_unlock currently does not check for errors in case of the
default mutex types (which is okay). When testing the new condvar
implementation, this lead to nptl/tst-cond25.c not aborting when
pthread_cond_wait returned after cancellation without actually having
acquired the mutex. This patch fixes that. Tested on x86_64-linux.
2015-02-16 Torvald Riegel <triegel@redhat.com>
* nptl/tst-cond25.c (cleanup): Explicitly check that the mutex is
acquired.
commit 35264d14426e1e3ca7b595db1de76208374b56e3
Author: Torvald Riegel <triegel@redhat.com>
Date: Sun Feb 15 17:33:31 2015 +0100
Make error checking effective in nptl/tst-cond25.c.
@@ -40,7 +40,15 @@ pthread_cond_t cond;
void cleanup (void *u)
{
- /* pthread_cond_wait should always return with the mutex locked. */
+ /* pthread_cond_wait should always return with the mutex locked. The
+ pthread_mutex_unlock implementation does not actually check whether we
+ own the mutex for several mutex kinds, so check this explicitly. */
+ int ret = pthread_mutex_trylock (&mutex);
+ if (ret != EDEADLK && ret != EBUSY)
+ {
+ printf ("mutex not locked in cleanup %d\n", ret);
+ abort ();
+ }
if (pthread_mutex_unlock (&mutex))
abort ();
}