Method
phasync::yield
Suspends the current coroutine until the loop has made its next round, after the coroutines that were ready have run.
Description#
public static phasync::yield(): voidLike sleep(0), it lets the others run, but it resumes after the coroutines that called sleep(0) in the same round. It returns at once outside a coroutine.
Examples#
phasync::run(function () {
phasync::go(function () { phasync::yield(); echo "yielded\n"; });
phasync::go(function () { phasync::sleep(); echo "slept\n"; });
}); // slept, yieldedSee also#
phasync::sleepPauses the current coroutine for$seconds, and lets the others run meanwhile.