pub fn yield() YieldError!void SystemCannotYieldThe system is not configured to allow yielding
380
381
382
383
384
385
386
387
388
389
390pub fn yield() YieldError!void {
if (native_os == .windows) switch (windows.ntdll.NtYieldExecution()) {
.SUCCESS, .NO_YIELD_PERFORMED => return,
else => return error.SystemCannotYield,
};
switch (posix.errno(posix.system.sched_yield())) {
.SUCCESS => return,
.NOSYS => return error.SystemCannotYield,
else => return error.SystemCannotYield,
}
}
Yields the current thread potentially allowing other threads to run.