'progn
'with-local-interrupts)))
`(let* ((,thread *current-thread*)
- (,prev (thread-waiting-for ,thread)))
+ (,prev (progn
+ (barrier (:read))
+ (thread-waiting-for ,thread))))
(flet ((exec () ,@body))
(if ,prev
(,without
(unwind-protect
(progn
(setf (thread-waiting-for ,thread) nil)
+ (barrier (:write))
(,with (exec)))
- (setf (thread-waiting-for ,thread) ,prev)))
+ ;; If we were waiting on a waitqueue, this becomes a bogus
+ ;; wakeup.
+ (when (mutex-p ,prev)
+ (setf (thread-waiting-for ,thread) ,prev)
+ (barrier (:write)))))
(exec)))))))
(sb!xc:defmacro with-mutex ((mutex &key (value '*current-thread*) (wait-p t))
(funcall function)))
(defun call-with-recursive-system-lock/without-gcing (function mutex)
- (declare (function function) (ignore lock))
+ (declare (function function) (ignore mutex))
(without-gcing
(funcall function))))