_mutexdestroy wasn't checking for a busy (locked by another thread) mutex:
-Jonathan
(Appologies if this is not the right forum, but the sourceforge patches
page doesn't look very busy.)
--- nsthread/mutex.c.old Mon Mar 31 15:28:01 2003
+++ nsthread/mutex.c Mon Mar 31 15:34:54 2003
@@ -168,10 +168,15 @@
{
Lock **lockPtrPtr;
Lock *lockPtr = (Lock *) *mutexPtr;
- int err;
+ int err = EBUSY;
if (lockPtr != NULL) {
- err = pthread_mutex_destroy(&lockPtr->mutex);
+ /* spinwait until it's unlocked */
+ while (err == EBUSY) {
+ err = pthread_mutex_destroy(&lockPtr->mutex);
+ }
+ /* {0,EBUSY} is supposed to be the only valid return codes for _destroy,
+ but we'll check anyway */
if (err != 0) {
NsThreadFatal("Ns_MutexDestroy", "ptread_mutex_destroy", err);
}
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list: http://www.aolserver.com/listserv.html
List information and options: http://listserv.aol.com/