interrupt ( thread -- )
Factor documentation > Factor handbook > The language > Co-operative threads > Yielding and suspending threads
Prev:sleep ( dt -- )
Next:suspend ( state -- obj )


Vocabulary
threads

Inputs and outputs
threada thread


Word description
Interrupts a sleeping thread.

Definition
USING: accessors heaps kernel ;

IN: threads

: interrupt ( thread -- )
dup state>> [
dup sleep-entry>> [ sleep-queue heap-delete ] when*
f >>sleep-entry dup resume
] when drop ;