From: Gabor M. <me...@us...> - 2009-03-16 15:59:18
|
Update of /cvsroot/sbcl/sbcl/src/code In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11975/src/code Modified Files: target-thread.lisp Log Message: 1.0.26.4: less pessimal waitqueues Readers calling CONDITION-WAIT don't interfere with each other. CONDITION-WAIT used to set WAITQUEUE-DATA to *CURRENT-THREAD* causing other readers entering FUTEX-WAIT to return with EWOULDBLOCK. Set WAITQUEUE-DATA to NIL in readers, and to *CURRENT-THREAD* in writers. Also, fix a warning in :SEMAPHORE-MULTIPLE-WAITERS test. Index: target-thread.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/code/target-thread.lisp,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- target-thread.lisp 1 Mar 2009 15:57:08 -0000 1.110 +++ target-thread.lisp 16 Mar 2009 15:59:03 -0000 1.111 @@ -328,7 +328,7 @@ (setf (mutex-%owner mutex) new-owner) t) #!-sb-lutex - ;; This is a direct tranlation of the Mutex 2 algorithm from + ;; This is a direct translation of the Mutex 2 algorithm from ;; "Futexes are Tricky" by Ulrich Drepper. (let ((old (sb!ext:compare-and-swap (mutex-state mutex) +lock-free+ @@ -463,7 +463,7 @@ ;; mutex on our way out. (without-interrupts (unwind-protect - (let ((me *current-thread*)) + (let ((me nil)) ;; This setf becomes visible to other CPUS due to the ;; usual memory barrier semantics of lock ;; acquire/release. @@ -487,6 +487,8 @@ (or to-usec 0)))) ((1) (signal-deadline)) ((2)) + ;; EWOULDBLOCK, -1 here, is the possible spurious + ;; wakeup case. 0 is the normal wakeup. (otherwise (return)))))) ;; If we are interrupted while waiting, we should do these ;; things before returning. Ideally, in the case of an @@ -497,7 +499,7 @@ (defun condition-notify (queue &optional (n 1)) #!+sb-doc "Notify N threads waiting on QUEUE. The same mutex that is used in -the correspoinding condition-wait must be held by this thread during +the corresponding CONDITION-WAIT must be held by this thread during this call." #!-sb-thread (declare (ignore queue n)) #!-sb-thread (error "Not supported in unithread builds.") |