Yielding and suspending threads - Factor Documentation (original) (raw)

Yielding and suspending threads
Factor handbook » The language » Co-operative threads

Prev: Starting and stopping threads
Next: Thread-local state and variables

Yielding to other threads:
yield ( -- )

Sleeping for a period of time:

sleep ( dt -- )

Interrupting sleep:

interrupt ( thread -- )

Threads can be suspended and woken up at some point in the future when a condition is satisfied:

suspend ( state -- obj )

resume ( thread -- )
resume-with ( obj thread -- )