Make error checking effective in nptl/tst-cond25.c.

This commit is contained in:
Torvald Riegel 2015-02-15 17:33:31 +01:00
parent 6f49e32aa5
commit 35264d1442
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-02-16 Torvald Riegel <triegel@redhat.com>
* nptl/tst-cond25.c (cleanup): Explicitly check that the mutex is
acquired.
2015-02-15 Matthew Fortune <Matthew.Fortune@imgtec.com>
[BZ #17792]

View File

@ -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 ();
}