Decentralize per-thread initial special bindings.
[sbcl.git] / src / code / early-thread.lisp
blob914b35679a5513bc85ad71a6fd3fe45b6ee29dfd
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
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 (!define-thread-local *current-thread* nil
13 "Bound in each thread to the thread itself.")
15 (def!type thread-name () 'simple-string)
17 (defstruct (thread (:constructor %make-thread)
18 (:copier nil))
19 "Thread type. Do not rely on threads being structs as it may change
20 in future versions."
21 (name nil :type (or thread-name null))
22 (%alive-p nil :type boolean)
23 (%ephemeral-p nil :type boolean)
24 #-sb-xc-host
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.
28 (result 0)
29 (interruptions-lock
30 (make-mutex :name "thread interruptions lock")
31 :type mutex)
32 (result-lock
33 (make-mutex :name "thread result lock")
34 :type mutex)
35 waiting-for)
37 (def!struct (mutex (:constructor make-mutex (&key name))
38 (:copier nil))
39 "Mutex type."
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))