Manipulating Threads
--------------------
- Function: thread-yield
This function may be used to pass control away from the current
thread if other threads are waiting to run. There is usually no
need to call this function since running threads will be preempted
after a period of time.
- Function: thread-suspend #!optional thread milliseconds
Mark THREAD (or the current thread) as being suspended. It will
not be selected until either it has had this status removed, or
MILLISECONDS milliseconds time has passed.
Suspending the current thread will pass control to the next
runnable thread in the same dynamic root. If there are no runnable
threads, then the interpreter will sleep until the next thread
becomes runnable.
- Function: thread-join thread #!optional timeout default-value
Suspends the current thread until either THREAD has exited, or
TIMEOUT milliseconds have passed.
If THREAD exits normally, then the value of the last form it
evaluated is returned; otherwise DEFAULT-VALUE is returned.
It is an error to call `thread-join' on a THREAD that is not a
member of the current dynamic root.
- Function: thread-wake thread
Remove the suspended state from thread THREAD. It will then be
scheduled for execution sometime subsequently, if its dynamic root
is active.
- Function: thread-suspended-p thread
Returns true if THREAD is currently suspended.
Thread preemption may be forbidden at times, to allow atomic
operations to take place. Each dynamic root has its own "forbid
counter". Only when this counter is zero may the current thread be
preempted.
- Function: thread-forbid
Increment the forbid count.
- Function: thread-permit
Decrement the forbid count.
- Macro: without-interrupts #!rest forms
Evaluate the list of forms FORMS with thread preemption
temporarily disabled.