X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fthread.lisp;h=09c2cc456d9252808885607cda781a5396e51d13;hb=a6a12ed609d5467ec43b411283e5b3568fee81df;hp=c471fc9e7050b51f14ad832402950b176071a904;hpb=6a503c1fa1831c2045f278b8d0523296e09c9cee;p=sbcl.git diff --git a/src/code/thread.lisp b/src/code/thread.lisp index c471fc9..09c2cc4 100644 --- a/src/code/thread.lisp +++ b/src/code/thread.lisp @@ -94,8 +94,8 @@ stale value, use MUTEX-OWNER instead." ,@body)) (sb!xc:defmacro with-spinlock ((lock) &body body) - (deprecation-warning :early "1.0.53.11" 'with-recursive-spinlock 'with-mutex) - `(with-lock (,lock) + (deprecation-warning :early "1.0.53.11" 'with-spinlock 'with-mutex) + `(with-mutex (,lock) ,@body)) (sb!xc:defmacro without-thread-waiting-for ((&key already-without-interrupts) &body body) @@ -107,15 +107,22 @@ stale value, use MUTEX-OWNER instead." '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)) @@ -207,7 +214,7 @@ provided the default value is used for the mutex." (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))))