Am Freitag, den 19.09.2008, 23:30 +0200 schrieb Jörg F. Wittenberger:
> > The attached patch fixes ##sys#thread-kill! wrt. to join timeouts.

The attached fix adds code to mutex-lock! and mutex-unlock! to remove
the thread from the timeout-list when a timeout was supplied and the
thread was not unblocked by timeout.

best regards

/Jörg
Index: srfi-18.scm
===================================================================
--- srfi-18.scm	(Revision 11974)
+++ srfi-18.scm	(Arbeitskopie)
@@ -239,8 +239,11 @@
 	    ct 1
 	    (lambda ()
 	      (case (##sys#slot thread 3)
-		[(dead) (apply return (##sys#slot thread 2))]
+		[(dead)
+		 (##sys#remove-from-timeout-list! ct)
+		 (apply return (##sys#slot thread 2))]
 		[(terminated)
+		 (##sys#remove-from-timeout-list! ct)
 		 (return 
 		  (##sys#signal
 		   (##sys#make-structure 
@@ -362,6 +365,8 @@
 		     (##sys#setslot mutex 3 (##sys#delq ct (##sys#slot mutex 3)))
 		     (##sys#setslot ##sys#current-thread 8 (cons mutex (##sys#slot ##sys#current-thread 8)))
 		     (##sys#setslot mutex 2 thread)
+		     (if (not (##sys#slot ct 13)) ; not unblocked by timeout
+			 (##sys#remove-from-timeout-list! ct))
 		     #f) )
 		  (##sys#thread-block-for-timeout! ct limit)
 		  (switch) ]
@@ -394,6 +399,8 @@
 		     ct 1
 		     (lambda () 
 		       (##sys#setslot cvar 2 (##sys#delq ct (##sys#slot cvar 2)))
+		       (if (not (##sys#slot ct 13)) ; not unblocked by timeout
+			   (##sys#remove-from-timeout-list! ct))
 		       (return #f) ) )
 		    (##sys#thread-block-for-timeout! ct limit) ]
 		   [else 
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to