[kaffe] CVS kaffe (alex): interrupt handling fix

Kaffe CVS cvs-commits at kaffe.org
Wed Dec 28 15:50:57 PST 2005


PatchSet 7066 
Date: 2005/12/28 23:42:09
Author: alex
Branch: HEAD
Tag: (none) 
Log:
interrupt handling fix
 - semaphore_get returns false, if semaphore_up was called within jthread_interrupt
   (necessary by function locks_internal_waitCond in kaffe/locks.c)
 - test/regression/ThreadInterrupt pass successful now

Members: 
	ChangeLog:1.4585->1.4586 
	kaffe/kaffevm/systems/drops-l4threads/jthread.h:1.1->1.2 
	kaffe/kaffevm/systems/drops-l4threads/lock-impl.h:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4585 kaffe/ChangeLog:1.4586
--- kaffe/ChangeLog:1.4585	Wed Dec 28 21:48:00 2005
+++ kaffe/ChangeLog	Wed Dec 28 23:42:09 2005
@@ -1,3 +1,10 @@
+2005-12-29 Alexander Boettcher  <alex at kaffe.org>
+
+	* kaffe/kaffevm/system/drops-l4threads/jthread.h,
+	  kaffe/kaffevm/system/drops-l4threads/lock-impl.h:
+	  jthread_interrupt & semaphore fix
+	  - test/regression/ThreadInterrupt.java pass successful now
+	
 2005-12-28 Dalibor Topic  <robilad at kaffe.org>
 
 	* WHATSNEW, TODO: Updated.
Index: kaffe/kaffe/kaffevm/systems/drops-l4threads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/drops-l4threads/jthread.h:1.1 kaffe/kaffe/kaffevm/systems/drops-l4threads/jthread.h:1.2
--- kaffe/kaffe/kaffevm/systems/drops-l4threads/jthread.h:1.1	Fri Nov 25 13:41:28 2005
+++ kaffe/kaffe/kaffevm/systems/drops-l4threads/jthread.h	Wed Dec 28 23:42:12 2005
@@ -175,8 +175,10 @@
   thread->interrupting = 1;
 
   /* bad hack, because of races ! */
-  if (thread->data.sem.l4sem.counter < 0 )
+  if (thread->data.sem.l4sem.counter < 0 ) {
+    thread->data.sem.failed = true;
     ksem_put(&thread->data.sem);
+  }
 
 }
 
Index: kaffe/kaffe/kaffevm/systems/drops-l4threads/lock-impl.h
diff -u kaffe/kaffe/kaffevm/systems/drops-l4threads/lock-impl.h:1.1 kaffe/kaffe/kaffevm/systems/drops-l4threads/lock-impl.h:1.2
--- kaffe/kaffe/kaffevm/systems/drops-l4threads/lock-impl.h:1.1	Fri Nov 25 13:41:28 2005
+++ kaffe/kaffe/kaffevm/systems/drops-l4threads/lock-impl.h	Wed Dec 28 23:42:12 2005
@@ -23,11 +23,13 @@
  typedef int jcondvar;
  typedef struct Ksem{
    l4semaphore_t l4sem;
+   jboolean failed; 
  } Ksem;
 
  static inline void ksem_init(struct Ksem* sem)
  {
-   sem->l4sem = L4SEMAPHORE_INIT(0);
+   sem->l4sem  = L4SEMAPHORE_INIT(0);
+   sem->failed = false;
  }
 
  static inline void ksem_put(struct Ksem* sem)
@@ -44,12 +46,18 @@
    } else {
      ret = !(l4semaphore_down_timed(&sem->l4sem,(unsigned)timeout));
    }
+
+   if (sem->failed == true) {
+     ret = sem->failed = false;
+   }
+   
    return ret;
  }
 
  static inline void ksem_destroy(struct Ksem* sem)
  {
-   sem->l4sem = L4SEMAPHORE_INIT(0);
+   sem->l4sem  = L4SEMAPHORE_INIT(0);
+   sem->failed = false;
  }
 
 #endif /* _drops_lock_impl_h */




More information about the kaffe mailing list