resume-with ( obj thread -- ) (original) (raw)

resume-with ( obj thread -- )
Factor handbook » The language » Co-operative threads » Yielding and suspending threads

Prev: resume ( thread -- )

Vocabulary
threads

Inputs

obj an object
thread a thread

Outputs
None

Word description
Adds a thread to the end of the run queue together with an object to pass to the thread. The thread must have previously been suspended by a call to suspend; the object is returned from the suspend call.

Definition

USING: accessors arrays deques ;

IN: threads

: resume-with ( obj thread -- )
f >>state 2array run-queue push-front ;