X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-unithread.lisp;h=0eddbbb83ed955d6b8ff13b7e9f0339e1a4f6bad;hb=6a9bbe6f36179cee92001a1f9ed5ff38be512644;hp=651573d43c8078f10af34fd63ff804b58046ba27;hpb=9c0fdf35270405ee8384d7f6a5a4b641d5df33c4;p=sbcl.git diff --git a/src/code/target-unithread.lisp b/src/code/target-unithread.lisp index 651573d..0eddbbb 100644 --- a/src/code/target-unithread.lisp +++ b/src/code/target-unithread.lisp @@ -1,3 +1,14 @@ +;;;; unithread stub support for threads in the target machine + +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. + (in-package "SB!THREAD") ;;; used bu debug-int.lisp to access interrupt contexts @@ -14,9 +25,11 @@ ;;;; queues, locks ;; spinlocks use 0 as "free" value: higher-level locks use NIL -(defun get-spinlock (lock offset new-value) ) +(defun get-spinlock (lock offset new-value) + (declare (ignore lock offset new-value))) (defmacro with-spinlock ((queue) &body body) + (declare (ignore queue)) `(progn ,@body)) ;;;; the higher-level locking operations are based on waitqueues @@ -90,16 +103,19 @@ (return t)) (setf old-value t1)))) -(defmacro with-mutex ((mutex &key value (wait-p t)) &body body) - (cond ((not wait-p) - `(unless (mutex-value ,mutex) - (unwind-protect - (progn - (setf (mutex-value ,mutex) (or ,value t)) - ,@body) - (setf (mutex-value ,mutex) nil)))) - (t - `(progn ,@body)))) +(defun get-mutex (lock &optional new-value (wait-p t)) + (declare (type mutex lock)) + (let ((old-value (mutex-value lock))) + (when (and old-value wait-p) + (error "In unithread mode, mutex ~S was requested with WAIT-P ~S and ~ + new-value ~S, but has already been acquired (with value ~S)." + lock wait-p new-value old-value)) + (setf (mutex-value lock) new-value) + t)) + +(defun release-mutex (lock) + (declare (type mutex lock)) + (setf (mutex-value lock) nil)) ;;; what's the best thing to do with these on unithread? commented ;;; functions are the thread versions, just to remind me what they do @@ -128,7 +144,11 @@ time we reacquire LOCK and return to the caller." ;;;; job control (defun init-job-control () t) -(defun debugger-wait-until-foreground-thread (stream) t) +(defun debugger-wait-until-foreground-thread (stream) + (declare (ignore stream)) + t) (defun get-foreground () t) -(defun release-foreground (&optional next) t) +(defun release-foreground (&optional next) + (declare (ignore next)) + t) (defun terminate-session ())