Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Separately report unlocking an unlocked mutex...



details:   https://anonhg.NetBSD.org/src/rev/961bac182a55
branches:  trunk
changeset: 547307:961bac182a55
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Fri May 16 21:28:26 2003 +0000

description:
Separately report unlocking an unlocked mutex and unlocking a mutex
owned by another thread.

diffstat:

 lib/libpthread/pthread_mutex.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 7f2665e962d0 -r 961bac182a55 lib/libpthread/pthread_mutex.c
--- a/lib/libpthread/pthread_mutex.c    Fri May 16 20:08:01 2003 +0000
+++ b/lib/libpthread/pthread_mutex.c    Fri May 16 21:28:26 2003 +0000
@@ -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 @@
                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;
        }
 



Home | Main Index | Thread Index | Old Index