From a47f7b1f81a9b122168210fdd859f85017fb5890 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 1 Jun 2018 14:15:27 -0700 Subject: [PATCH] Add optional name parameter to create-thread. --- src/runtime/thread.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/thread.scm b/src/runtime/thread.scm index 0ca02f92b..4691a9a40 100644 --- a/src/runtime/thread.scm +++ b/src/runtime/thread.scm @@ -210,7 +210,7 @@ USA. (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" @@ -226,6 +226,9 @@ USA. (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))))) -- 2.25.1