(MAKE-PLACEHOLDER) => placeholder
(PLACEHOLDER-VALUE placeholder) => value of placeholder
(PLACEHOLDER-SET! placeholder value)
(PLACEHOLDER? thing) => #t or #f
Attempts to reference a placeholder before it has been set cause the
referencing thread to block. Setting a placeholder to two different
values is an error. (Previous versions of Scheme 48 called these
`condition variables', which turn out to be somewhat different.)
Threads and the command interpreter
Each level of the command interpreter has its own set of active
threads. Moving to a new level, for example when an error occurs,
halts all threads belonging to the previous level. Resuming the
a level causes its associated threads to continue running.
The ,threads command inspects the threads running in the stopped
command level.
> ,open threads
> (define (foo) (sleep 1000) (display "Hi") (newline) (foo))
> (spawn foo 'my-thread)
> Hi
(begin (sleep 10000) (display "Done") (newline))
Hi
Interrupt: keyboard
1> (sleep 5000)
; note that the Hi thread doesn't run in this command level
1> ,proceed 0
Hi
; but it resumes when we resume this level
Hi
Done
> Hi
Hi
Hi
Interrupt: keyboard
1> ,threads
'(#{Thread 28 my-thread} #{Thread 27 command-loop})
[0] '#{Thread 28 my-thread}
[1] '#{Thread 27 command-loop}
inspect: