- (let ((old-value (mutex-value lock))
- (t1 nil))
- (loop
- (unless
- ;; args are object slot-num old-value new-value
- (eql old-value
- (setf t1
- (sb!vm::%instance-set-conditional lock 4 old-value new-value)))
- (signal-queue-head lock)
- (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))))
-
-;;; what's the best thing to do with these on unithread?
-#+NIl
-(defun condition-wait (queue lock)
- "Atomically release LOCK and enqueue ourselves on QUEUE. Another
-thread may subsequently notify us using CONDITION-NOTIFY, at which
-time we reacquire LOCK and return to the caller."
- (unwind-protect
- (wait-on-queue queue lock)
- ;; If we are interrupted while waiting, we should do these things
- ;; before returning. Ideally, in the case of an unhandled signal,
- ;; we should do them before entering the debugger, but this is
- ;; better than nothing.
- (dequeue queue)
- (get-mutex lock)))
-
-#+nil
-(defun condition-notify (queue)
- "Notify one of the processes waiting on QUEUE"
- (signal-queue-head queue))
-
-
-;;;; multiple independent listeners
-
-(defvar *session-lock* nil)
+ (setf (mutex-value lock) nil))
+
+
+;; FIXME need suitable stub or ERROR-signaling definitions for
+;; condition-wait (queue lock)
+;; condition-notify (queue)