diff options
| author | nathanw <nathanw@NetBSD.org> | 2003-05-16 21:28:26 +0000 |
|---|---|---|
| committer | nathanw <nathanw@NetBSD.org> | 2003-05-16 21:28:26 +0000 |
| commit | baa073280b9727079d636aed169e96b79641f6ee (patch) | |
| tree | bd7e2475e1fa5e07244d4023527677cd4678ec09 /lib/libpthread/pthread_mutex.c | |
| parent | adaf65b7b46cd138c62d3d2bcb95eda5fdfbef89 (diff) | |
Separately report unlocking an unlocked mutex and unlocking a mutex
owned by another thread.
Diffstat (limited to 'lib/libpthread/pthread_mutex.c')
| -rw-r--r-- | lib/libpthread/pthread_mutex.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libpthread/pthread_mutex.c b/lib/libpthread/pthread_mutex.c index c1083d14399..e062006c9a3 100644 --- a/lib/libpthread/pthread_mutex.c +++ b/lib/libpthread/pthread_mutex.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_mutex.c,v 1.14 2003/04/23 19:36:12 nathanw Exp $ */ +/* $NetBSD: pthread_mutex.c,v 1.15 2003/05/16 21:28:26 nathanw Exp $ */ /*- * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pthread_mutex.c,v 1.14 2003/04/23 19:36:12 nathanw Exp $"); +__RCSID("$NetBSD: pthread_mutex.c,v 1.15 2003/05/16 21:28:26 nathanw Exp $"); #include <errno.h> #include <limits.h> @@ -334,8 +334,12 @@ pthread_mutex_unlock(pthread_mutex_t *mutex) if (!weown) return EPERM; default: - pthread__error(EPERM, - "Unlocking mutex owned by another thread", weown); + if (__predict_false(!weown)) { + pthread__error(EPERM, "Unlocking unlocked mutex", + (mutex->ptm_owner != 0)); + pthread__error(EPERM, + "Unlocking mutex owned by another thread", weown); + } break; } |
