(define (thread-dead? thread)
(guarantee thread? thread 'THREAD-DEAD?)
(eq? 'DEAD (thread/execution-state thread)))
+
+(define (thread-get thread property)
+ (guarantee thread? thread 'thread-get)
+ (1d-table/get (thread/properties thread) property #f))
+
+(define (thread-put! thread property value)
+ (guarantee thread? thread 'thread-put!)
+ (1d-table/put! (thread/properties thread) property value))
\f
(define thread-population)
(define first-running-thread)
(guarantee thread? thread 'THREAD-EXECUTION-STATE)
(thread/execution-state thread))
-(define (create-thread root-continuation thunk)
+(define (create-thread root-continuation thunk #!optional name)
(if (not (or (not root-continuation) (continuation? root-continuation)))
(error:wrong-type-argument root-continuation
"continuation or #f"
(call-with-current-continuation
(lambda (continuation)
(let ((thread (make-thread continuation)))
+ (if (not (default-object? name))
+ (1d-table/put! (thread/properties thread)
+ 'name name))
(%within-continuation (let ((k return)) (set! return #f) k)
#t
(lambda () thread)))))