Update of /cvsroot/sbcl/sbcl/src/code
In directory sc8-pr-cvs1:/tmp/cvs-serv3933/src/code
Modified Files:
target-thread.lisp
Log Message:
0.pre8.118
Fix WITH-MUTEX bug: don't release the mutex if we didn't
manage to acquire it in the first place
Index: target-thread.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/target-thread.lisp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- target-thread.lisp 2 Apr 2003 12:46:20 -0000 1.3
+++ target-thread.lisp 29 Apr 2003 00:28:43 -0000 1.4
@@ -140,12 +140,13 @@
(setf old-value t1))))
(defmacro with-mutex ((mutex &key value (wait-p t)) &body body)
- (let ((block (gensym "NIL")))
- `(unwind-protect
- (block ,block
- (unless (get-mutex ,mutex ,value ,wait-p) (return-from ,block nil))
- ,@body)
- (release-mutex ,mutex))))
+ (let ((block (gensym "NIL"))
+ (got (gensym "GOT")))
+ `(let ((,got (get-mutex ,mutex ,value ,wait-p)))
+ (when ,got
+ (unwind-protect
+ (progn ,@body)
+ (release-mutex ,mutex))))))
;;;; condition variables
|