X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fthread.lisp;h=378fb4b159ce8909996660047bd21c660901f7c6;hb=72db452798256d266d5909bd330d9eb5b31c6f1e;hp=ab393f58015c1637e3a098fd22fa5f61705f632c;hpb=5502b6348a7471021b39b926a2b9d2b457f5ca62;p=sbcl.git diff --git a/src/code/thread.lisp b/src/code/thread.lisp index ab393f5..378fb4b 100644 --- a/src/code/thread.lisp +++ b/src/code/thread.lisp @@ -11,6 +11,18 @@ (in-package "SB!THREAD") +(def!struct mutex + #!+sb-doc + "Mutex type." + (name nil :type (or null simple-string)) + (value nil)) + +(def!struct spinlock + #!+sb-doc + "Spinlock type." + (name nil :type (or null simple-string)) + (value 0)) + (sb!xc:defmacro with-mutex ((mutex &key (value '*current-thread*) (wait-p t)) &body body) #!+sb-doc @@ -43,7 +55,8 @@ further recursive lock attempts for the same mutex succeed. It is allowed to mix WITH-MUTEX and WITH-RECURSIVE-LOCK for the same mutex provided the default value is used for the mutex." #!-sb-thread - (declare (ignore mutex)) #!+sb-thread + (declare (ignore mutex)) + #!+sb-thread (with-unique-names (mutex1 inner-lock-p) `(let* ((,mutex1 ,mutex) (,inner-lock-p (eq (mutex-value ,mutex1) *current-thread*)))