Patch to mutex.c

Neale.Ferguson@softwareAG-usa.com Neale.Ferguson@softwareAG-usa.com
Wed Sep 27 09:06:00 GMT 2000


Sorry about raising this again, but does the comment below mean this patch will
be included? I've included it on my system and running some POSIX conformance
tests which it is now passing.

--- mutex.c     2000/09/20 14:35:30     1.1
+++ mutex.c     2000/09/21 17:46:11
@@ -165,15 +165,20 @@
   case PTHREAD_MUTEX_RECURSIVE_NP:
     if (mutex->__m_count > 0) {
       mutex->__m_count--;
       return 0;
     }
-    mutex->__m_owner = NULL;
-    __pthread_unlock(&mutex->__m_lock);
-    return 0;
+    if (mutex->__m_owner != NULL) {
+      mutex->__m_owner = NULL;
+      __pthread_unlock(&mutex->__m_lock);
+      return 0;
+    }
+    else
+      return EPERM;
+

> Further to the behavior of RECURSIVE mutexes. The man file does indicate the
> unpredictable nature of unlocking and non-locked mutex. I noted several
> exchanges on this list on the subject of man pages versus the standard.

>> By golly, you are right! The Single UNIX Specification does, in fact, require
>> recursive mutexes to have error checking properties. This needs to be fixed.



More information about the Libc-alpha mailing list