Next: Special Variables, Up: Threading
(make-thread (lambda () (write-line "Hello, world")))
Class precedence list:
thread, structure-object, t
Thread type. Do not rely on threads being structs as it may change in future versions.
Create a new thread of
name
that runsfunction
. When the function returns the thread exits. The return values offunction
are kept around and can be retrieved byjoin-thread
.
Suspend current thread until
thread
exits. Returns the result values of the thread function. If the thread does not exit normally, returndefault
if given or else signaljoin-thread-error
.
Class precedence list:
join-thread-error, error, serious-condition, condition, t
Joining thread failed.
Class precedence list:
interrupt-thread-error, error, serious-condition, condition, t
Interrupting thread failed.
Interrupt the live
thread
and make it runfunction
. A moderate degree of care is expected for use ofinterrupt-thread
, due to its nature: if you interrupt a thread that was holding important locks then do something that turns out to need those locks, you probably won't like the effect.