The bindings described in this section are part of the threads
structure.
Spawn creates a new thread, passes that thread to the current
scheduler, and instructs the scheduler to run thunk in that
thread. The name argument (a symbol) associates a symbolic
name with the thread; it is purely for debugging purposes.
Relinquish-timeslice instructs the scheduler to run another
thread, thus relinquishing the timeslice of the current thread.
Sleep does the same and asks the scheduler to suspend the
current thread for at least time-in-milliseconds milliseconds
before resuming it. Finally, terminate-current-thread
terminates the current thread.
Each thread is represented by a thread object. The following procedures operate on that object:
(current-thread) -> thread
(thread? thing) -> boolean
(thread-name thread) -> name
(thread-uid thread) -> integer
Current-thread returns the thread object associated with the
currently running thread.
Thread? is the predicate for thread objects.
Thread-name extracts the name of the thread, if one was
specified in the call to spawn, #f otherwise.
Thread-uid returns the uid of the thread, a unique
integer assigned by the thread system.
Previous: Creating and controlling threads | Next: Creating and controlling threads