0.pre8.10
[sbcl/lichteblau.git] / src / code / thread.lisp
blobc5c71049a0ab58ddef761f13d25e5dc85ec98e38
1 (in-package :sb!thread)
3 #+sb-xc-host
4 (defun make-mutex (&key name value) nil)
6 #+sb-xc-host
7 (defmacro with-recursive-lock ((mutex) &body body)
8 `(progn ,@body))
10 #-sb-xc-host
11 (defmacro with-recursive-lock ((mutex) &body body)
12 (let ((cfp (gensym "CFP")))
13 `(let ((,cfp (ash (sb!sys:sap-int (sb!vm::current-fp) ) -2)))
14 (unless (and (mutex-value ,mutex)
15 (SB!DI::control-stack-pointer-valid-p
16 (sb!sys:int-sap (ash (mutex-value ,mutex) 2))))
17 (get-mutex ,mutex ,cfp))
18 (unwind-protect
19 (progn ,@body)
20 (when (eql (mutex-value ,mutex) ,cfp) (release-mutex ,mutex))))))
22 (defun get-foreground ()
23 (when (not (eql (mutex-value *session-lock*) (CURRENT-THREAD-ID)))
24 (get-mutex *session-lock*))
25 (sb!sys:enable-interrupt :sigint #'sb!unix::sigint-handler)
28 (defun release-foreground ()
29 (sb!sys:enable-interrupt :sigint :ignore)
30 (release-mutex *session-lock*)