From 35264d14426e1e3ca7b595db1de76208374b56e3 Mon Sep 17 00:00:00 2001 From: Torvald Riegel Date: Sun, 15 Feb 2015 17:33:31 +0100 Subject: [PATCH] Make error checking effective in nptl/tst-cond25.c. --- ChangeLog | 5 +++++ nptl/tst-cond25.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a0f0ae290dd..78fe389f28e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-02-16 Torvald Riegel + + * nptl/tst-cond25.c (cleanup): Explicitly check that the mutex is + acquired. + 2015-02-15 Matthew Fortune [BZ #17792] diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c index d80d8f7e762..be0bec484d7 100644 --- a/nptl/tst-cond25.c +++ b/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 (); } -- 2.47.3