1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!THREAD")
12 (eval-when (:compile-toplevel
:load-toplevel
:execute
)
13 (defvar *current-thread
* nil
))
15 (def!type thread-name
() 'simple-string
)
17 (defstruct (thread (:constructor %make-thread
)
19 "Thread type. Do not rely on threads being structs as it may change
21 (name nil
:type
(or thread-name null
))
22 (%alive-p nil
:type boolean
)
23 (%ephemeral-p nil
:type boolean
)
25 (os-thread 0 :type sb
!vm
:word
)
26 (interruptions nil
:type list
)
27 ;; On succesful execution of the thread's lambda a list of values.
30 (make-mutex :name
"thread interruptions lock")
33 (make-mutex :name
"thread result lock")
37 (def!struct
(mutex (:constructor make-mutex
(&key name
))
40 (name nil
:type
(or null thread-name
))
41 (%owner nil
:type
(or null thread
))
42 #!+(and sb-thread sb-futex
)
43 (state 0 :type fixnum
))