X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fthread.lisp;h=4c688bf2b0e7b1d7027b7f9351c0daf53410186e;hb=d6f9676ae94419cb5544c45821a8d31adbc1fbe8;hp=85eb1c82dadf4a8df6f7551a9756a7ca6b2ddab0;hpb=23e31980c78d174ef9cb775bf28f970890327fea;p=sbcl.git diff --git a/src/code/thread.lisp b/src/code/thread.lisp index 85eb1c8..4c688bf 100644 --- a/src/code/thread.lisp +++ b/src/code/thread.lisp @@ -36,10 +36,8 @@ in future versions." "Mutex type." (name nil :type (or null thread-name)) (%owner nil :type (or null thread)) - #!+(and (not sb-lutex) sb-thread) - (state 0 :type fixnum) - #!+(and sb-lutex sb-thread) - (lutex (make-lutex))) + #!+(and sb-thread sb-futex) + (state 0 :type fixnum)) (defun mutex-value (mutex) "Current owner of the mutex, NIL if the mutex is free. May return a @@ -71,6 +69,26 @@ stale value, use MUTEX-OWNER instead." (name nil :type (or null thread-name)) (value nil)) +(sb!xc:defmacro without-thread-waiting-for ((&key already-without-interrupts) &body body) + (with-unique-names (thread prev) + (let ((without (if already-without-interrupts + 'progn + 'without-interrupts)) + (with (if already-without-interrupts + 'progn + 'with-local-interrupts))) + `(let* ((,thread *current-thread*) + (,prev (thread-waiting-for ,thread))) + (flet ((exec () ,@body)) + (if ,prev + (,without + (unwind-protect + (progn + (setf (thread-waiting-for ,thread) nil) + (,with (exec))) + (setf (thread-waiting-for ,thread) ,prev))) + (exec))))))) + (sb!xc:defmacro with-mutex ((mutex &key (value '*current-thread*) (wait-p t)) &body body) #!+sb-doc