Io module

yield

procedureextensionexperimentalSource

Lets the other ready fibers run first. .CANCELED if this fiber was canceled.

Example↗
Io :: #import "Extensions/Io";

Io.io_run(() {
    log: [..] int;
    Io.spawn((out: *[..] int) { array_add(out, 2); }, *log);
    array_add(*log, 1);
    Io.yield();            // the spawned fiber runs now
    array_add(*log, 3);
    assert(log[0] == 1 && log[1] == 2 && log[2] == 3);
});
yield :: () -> Io_Error

Returns

See also