Add thread-get and thread-put! for e.g. giving threads names.
authorMatt Birkholz <matt@birchwood-abbey.net>
Tue, 5 Jun 2018 17:11:05 +0000 (10:11 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Tue, 5 Jun 2018 17:11:05 +0000 (10:11 -0700)
src/runtime/runtime.pkg
src/runtime/thread.scm

index fd3f32731c32f2a9aafdf34e8b58d4621e2c05bf..368368723edbee750a54a8d432a932640b9bc591 100644 (file)
@@ -4995,8 +4995,10 @@ USA.
          thread-continuation
          thread-dead?
          thread-execution-state
+         thread-get
          thread-mutex-owner
          thread-mutex?
+         thread-put!
          thread-timer-interval
          thread?
          threads-list
index 693aacd28ad626ff5abfa8610f925d6a68cfb38d..0ca02f92bc90d4497067467a255d7d1255142b97 100644 (file)
@@ -99,6 +99,14 @@ USA.
 (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)