[kaffe] CVS kaffe (guilhem): Fixes for freebsd5.

Kaffe CVS cvs-commits at kaffe.org
Sat Apr 2 07:38:29 PST 2005


PatchSet 5643 
Date: 2005/04/02 15:33:33
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixes for freebsd5.

        * kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
        (jthread_exit): Removed the use of pthread_cancel during
        final shutdown.

        * kaffe/kaffevm/systems/unix-pthreads/lock-impl.c
        (clearBlockState): Do not exit if the thread is in BS_THREAD
        blockstate it means the mutex be released.

Members: 
	ChangeLog:1.3813->1.3814 
	kaffe/kaffevm/systems/unix-pthreads/lock-impl.c:1.20->1.21 
	kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.79->1.80 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3813 kaffe/ChangeLog:1.3814
--- kaffe/ChangeLog:1.3813	Sat Apr  2 14:17:02 2005
+++ kaffe/ChangeLog	Sat Apr  2 15:33:33 2005
@@ -1,3 +1,13 @@
+2005-04-02  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
+	(jthread_exit): Removed the use of pthread_cancel during
+	final shutdown.
+
+	* kaffe/kaffevm/systems/unix-pthreads/lock-impl.c
+	(clearBlockState): Do not exit if the thread is in BS_THREAD
+	blockstate it means the mutex be released.
+
 2005-04-02  Riccardo Mottola <zuse at libero.it>
 
 	* FAQ/FAQ.Known-Bugs:
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c:1.20 kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c:1.21
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c:1.20	Thu Mar 31 10:39:29 2005
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c	Sat Apr  2 15:33:36 2005
@@ -76,7 +76,7 @@
   /* Catch an interrupt event sent while we were being killed.
    * This is needed for Darwin's pthreads.
    */
-  if (cur->status == THREAD_KILL)
+  if (cur->status == THREAD_KILL && ((cur->blockState & BS_THREAD) == 0))
     pthread_exit(NULL);
 
   pthread_sigmask(SIG_SETMASK, old_mask, NULL);
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.79 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.80
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.79	Fri Apr  1 17:21:52 2005
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c	Sat Apr  2 15:33:36 2005
@@ -801,6 +801,9 @@
 	  break;
 	}
 
+	if (cur->status == THREAD_KILL)
+	  break;
+
 	/* Wait until we get re-used (by TcreateThread). No need to update the
 	 * blockState, since we aren't active anymore */
 	repsem_wait( &cur->sem);
@@ -1063,15 +1066,14 @@
 		if ( t != cur && t != firstThread) {
 		  /* Mark the thread as to be killed. */
 		  t->status = THREAD_KILL;
-		  /* Send an interrupt event to the remote thread.
-		   * We try to restrain ourself from using pthread_cancel
-		   * as it seems to cause deadlocks on some pthread
-		   * implementations.
+		  /* Send an interrupt event to the remote thread to wake up.
+		   * This may not work in any cases. However that way we prevent a
+		   * predictable deadlock on some threads implementation.
 		   */
-		  if (t->blockState & (BS_CV|BS_CV_TO))
-		     jthread_interrupt(t);
-		  else
-		     pthread_cancel(t->tid);
+		  jthread_interrupt(t);
+		  unprotectThreadList(cur);
+		  pthread_join(t->tid, NULL);
+		  protectThreadList(cur);
 		}
 	  }
 




More information about the kaffe mailing list