X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-thread.lisp;h=06002df4aed862289ec1b714dfcb01614e6a251c;hb=00a72df911b4089d1bce75684d2ee8da9937447d;hp=ed47314e0764e2f28d2c6e51a21b3d2d044455da;hpb=bfb7c2d573bacfd9c5f3f243b7c1589f81f11406;p=sbcl.git diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp index ed47314..06002df 100644 --- a/src/code/target-thread.lisp +++ b/src/code/target-thread.lisp @@ -125,6 +125,9 @@ in future versions." (sb!alien:define-alien-routine ("lutex_lock" %lutex-lock) int (lutex unsigned-long)) + (sb!alien:define-alien-routine ("lutex_trylock" %lutex-trylock) + int (lutex unsigned-long)) + (sb!alien:define-alien-routine ("lutex_unlock" %lutex-unlock) int (lutex unsigned-long)) @@ -254,11 +257,11 @@ until it is available" (format *debug-io* "Thread: ~A~%" *current-thread*) (sb!debug:backtrace most-positive-fixnum *debug-io*) (force-output *debug-io*)) - ;; FIXME: sb-lutex and (not wait-p) #!+sb-lutex - (when wait-p - (with-lutex-address (lutex (mutex-lutex mutex)) - (%lutex-lock lutex)) + (when (zerop (with-lutex-address (lutex (mutex-lutex mutex)) + (if wait-p + (%lutex-lock lutex) + (%lutex-trylock lutex)))) (setf (mutex-value mutex) new-value)) #!-sb-lutex (let (old)