(setf (fdocumentation '*current-thread* 'variable)
"Bound in each thread to the thread itself.")
-(defstruct (thread (:constructor %make-thread))
- #!+sb-doc
- "Thread type. Do not rely on threads being structs as it may change
-in future versions."
- name
- %alive-p
- os-thread
- interruptions
- (interruptions-lock (make-mutex :name "thread interruptions lock"))
- result
- (result-lock (make-mutex :name "thread result lock")))
-
#!+sb-doc
(setf
(fdocumentation 'thread-name 'function)
;; continuing after a deadline or EINTR.
(setf (waitqueue-data queue) me)
(loop
- (multiple-value-bind (to-sec to-usec) (decode-timeout nil)
+ (multiple-value-bind (to-sec to-usec)
+ (allow-with-interrupts (decode-timeout nil))
(case (unwind-protect
(with-pinned-objects (queue me)
;; RELEASE-MUTEX is purposefully as close to
(allow-with-interrupts
(futex-wait (waitqueue-data-address queue)
(get-lisp-obj-address me)
- ;; our way if saying "no
+ ;; our way of saying "no
;; timeout":
(or to-sec -1)
(or to-usec 0))))
;; them before entering the debugger, but this is
;; better than nothing.
(allow-with-interrupts (get-mutex mutex)))
- ;; ETIMEDOUT
- ((1) (signal-deadline))
+ ;; ETIMEDOUT; we know it was a timeout, yet we cannot
+ ;; signal a deadline unconditionally here because the
+ ;; call to GET-MUTEX may already have signaled it.
+ ((1))
;; EINTR
((2))
;; EWOULDBLOCK, -1 here, is the possible spurious wakeup
(setup-sem (make-semaphore :name "Thread setup semaphore"))
(real-function (coerce function 'function))
(initial-function
- (lambda ()
+ (named-lambda initial-thread-function ()
;; In time we'll move some of the binding presently done in C
;; here too.
;;