Fluidize (runtime thread) internal root-continuation-default.
authorMatt Birkholz <puck@birchwood-abbey.net>
Wed, 13 Aug 2014 04:03:12 +0000 (21:03 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Wed, 13 Aug 2014 04:03:12 +0000 (21:03 -0700)
src/runtime/thread.scm

index 35fcd6edd4f5f5213f8871d8858134339b0cfd0a..5706478d4987f3c49bfec415cef302b36173d08b 100644 (file)
@@ -98,6 +98,7 @@ USA.
 (define root-continuation-default)
 
 (define (initialize-package!)
+  (set! root-continuation-default (make-fluid #f))
   (initialize-error-conditions!)
   (set! thread-population (make-population))
   (set! first-running-thread #f)
@@ -139,7 +140,8 @@ USA.
                                 create-thread))
   (call-with-current-continuation
    (lambda (return)
-     (%within-continuation (or root-continuation root-continuation-default)
+     (%within-continuation (or root-continuation
+                              (fluid root-continuation-default))
                           #t
        (lambda ()
         (fluid-let ((state-space:local (make-state-space)))
@@ -153,15 +155,15 @@ USA.
           (exit-current-thread (thunk))))))))
 
 (define (create-thread-continuation)
-  root-continuation-default)
+  (fluid root-continuation-default))
 
 (define (with-create-thread-continuation continuation thunk)
   (if (not (continuation? continuation))
       (error:wrong-type-argument continuation
                                 "continuation"
                                 with-create-thread-continuation))
-  (fluid-let ((root-continuation-default continuation))
-    (thunk)))
+  (let-fluid root-continuation-default continuation
+    thunk))
 \f
 (define (current-thread)
   (or first-running-thread