0.pre8.118
authorDaniel Barlow <dan@telent.net>
Tue, 29 Apr 2003 00:28:42 +0000 (00:28 +0000)
committerDaniel Barlow <dan@telent.net>
Tue, 29 Apr 2003 00:28:42 +0000 (00:28 +0000)
Fix WITH-MUTEX bug: don't release the mutex if we didn't
manage to acquire it in the first place

src/code/target-thread.lisp
version.lisp-expr

index 0a9ab3b..18b278e 100644 (file)
      (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
index 5eed17a..4f8fa0d 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.pre8.117"
+"0.pre8.118"