1 (in-package :sb!thread)
3 (sb!xc:defmacro with-recursive-lock ((mutex) &body body)
5 (let ((cfp (gensym "CFP")))
6 `(let ((,cfp (ash (sb!sys:sap-int (sb!vm::current-fp) ) -2)))
7 (unless (and (mutex-value ,mutex)
8 (SB!DI::control-stack-pointer-valid-p
9 (sb!sys:int-sap (ash (mutex-value ,mutex) 2))))
10 (get-mutex ,mutex ,cfp))
13 (when (eql (mutex-value ,mutex) ,cfp) (release-mutex ,mutex)))))
18 (defun get-foreground ()
19 (when (not (eql (mutex-value *session-lock*) (current-thread-id)))
20 (get-mutex *session-lock*))
21 (sb!sys:enable-interrupt :sigint #'sb!unix::sigint-handler)
24 (defun get-foreground () t)
27 (defun release-foreground ()
28 (sb!sys:enable-interrupt :sigint :ignore)
29 (release-mutex *session-lock*)
32 (defun release-foreground () t)