: log-server ( -- )
[
- init-namespaces
+ init-namestack
[ log-server-loop ]
[ error. (close-logs) ]
recover t
{ $values { "quot" quotation } { "name" string } { "thread" thread } }
{ $description "Spawns a new thread. The thread begins executing the given quotation; the name is for debugging purposes. The new thread begins running immediately and the current thread is added to the end of the run queue."
$nl
-"The new thread begins with an empty data stack, an empty retain stack, and an empty catch stack. The name stack is inherited from the parent thread but may be cleared with " { $link init-namespaces } "." }
+"The new thread begins with an empty data stack, an empty retain stack, and an empty catch stack. The name stack is inherited from the parent thread but may be cleared with " { $link init-namestack } "." }
{ $notes
"The recommended way to pass data to the new thread is to explicitly construct a quotation containing the data, for example using " { $link curry } " or " { $link compose } "."
}
! Used by compiler.codegen to wrap callback bodies
: do-callback ( callback-quot wait-quot: ( callback -- ) -- )
t CONTEXT-OBJ-IN-CALLBACK-P set-context-object
- init-namespaces
+ init-namestack
init-catchstack
current-callback
[ 2drop call ] [ swap call( callback -- ) drop ] 3bi ; inline
: add-shutdown-hook ( quot name -- )
shutdown-hooks get set-at ;
-: boot ( -- ) init-namespaces init-catchstack init-error-handler ;
+: boot ( -- ) init-namestack init-catchstack init-error-handler ;
: startup-quot ( -- quot ) OBJ-STARTUP-QUOT special-object ;
HELP: ndrop
{ $description "Pops a namespace from the namestack." } ;
-HELP: init-namespaces
+HELP: init-namestack
{ $description "Resets the namestack to its initial state, holding a single copy of the global namespace." }
$low-level-note ;
: namespace ( -- namespace ) (get-namestack) last ; inline
: get-namestack ( -- namestack ) (get-namestack) clone ;
: set-namestack ( namestack -- ) >vector (set-namestack) ;
-: init-namespaces ( -- ) global 1array set-namestack ;
+: init-namestack ( -- ) global 1vector (set-namestack) ;
: get-global ( variable -- value ) global box-at value>> ; inline
: set-global ( value variable -- ) global set-at ; inline
: file-server-logging ( quot -- )
[
- init-namespaces
+ init-namestack
receive
dup first "log-message" = [