PatchSet 5635 
Date: 2005/04/01 17:00:51
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Recursive lock fix.

Members: 
        ChangeLog:1.3806->1.3807 
        kaffe/kaffevm/locks.c:1.60->1.61 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3806 kaffe/ChangeLog:1.3807
--- kaffe/ChangeLog:1.3806      Fri Apr  1 06:22:11 2005
+++ kaffe/ChangeLog     Fri Apr  1 17:00:51 2005
@@ -1,3 +1,8 @@
+2005-04-01  Guilhem Lavaux  <[EMAIL PROTECTED]>
+
+       * kaffe/kaffevm/locks.c
+       (waitCond): Unlock completely the mutex (the lock may be recursive).
+
 2005-04-01  Dalibor Topic  <[EMAIL PROTECTED]>
 
        * libraries/javalib/Makefile.am.in (clean-local): 
Index: kaffe/kaffe/kaffevm/locks.c
diff -u kaffe/kaffe/kaffevm/locks.c:1.60 kaffe/kaffe/kaffevm/locks.c:1.61
--- kaffe/kaffe/kaffevm/locks.c:1.60    Sun Mar 20 20:30:43 2005
+++ kaffe/kaffe/kaffevm/locks.c Fri Apr  1 17:00:55 2005
@@ -366,6 +366,7 @@
   volatile jthread_t *ptr;
   jboolean r;
   threadData *tdata;
+  unsigned int oldLockCount;
   
   DBG(SLOWLOCKS,
       dprintf("_waitCond(lk=%p, timeout=%ld, th=%p)\n",
@@ -384,6 +385,11 @@
   tdata = KTHREAD(get_data)(cur);
   tdata->nextlk = lk->cv;
   lk->cv = cur;
+  /* Here we need to reduce the lock count to 1 to be sure
+   * the lock is completely released when we invoke slowUnlockMutex.
+   */
+  oldLockCount = lk->lockCount;
+  lk->lockCount = 1;
 
   putHeavyLock(lk);
   slowUnlockMutex((volatile iLock *volatile *)lkp, heavyLock);
@@ -417,6 +423,10 @@
   }
   
   slowLockMutex((volatile iLock *volatile *)lkp, heavyLock);
+  /* This is safe as no other thread touches the lockcount if it is not
+   * owning the lock.
+   */
+  lk->lockCount = oldLockCount;
   
   return (r);
 }

_______________________________________________
kaffe mailing list
[email protected]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to