diff options
author | Torvald Riegel <triegel@redhat.com> | 2015-02-15 17:33:31 +0100 |
---|---|---|
committer | Torvald Riegel <triegel@redhat.com> | 2015-02-16 18:11:14 +0100 |
commit | 35264d14426e1e3ca7b595db1de76208374b56e3 (patch) | |
tree | 84bf5dd295d459d78fc5f564d02b71c0ab22a01c | |
parent | 6f49e32aa5c7c188b6b8e78a91636eb5ee2e1841 (diff) |
Make error checking effective in nptl/tst-cond25.c.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | nptl/tst-cond25.c | 10 |
2 files changed, 14 insertions, 1 deletions
@@ -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] diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c index d80d8f7e76..be0bec484d 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 (); } |