From 9813dee13076ca46f617b1773f3ab49e4d91adc8 Mon Sep 17 00:00:00 2001 From: cinder <> Date: Tue, 23 Apr 2024 13:14:10 -0700 Subject: [PATCH] fix spelling and grammar; clarify use of "os yield" not "sysyield" machine.lua uses "sysyield" to refer to forced yielding of the entire computer back to scala for execution time limits --- src/kernel/03_environment.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/03_environment.lua b/src/kernel/03_environment.lua index d4f19b5..22dc5af 100644 --- a/src/kernel/03_environment.lua +++ b/src/kernel/03_environment.lua @@ -14,10 +14,10 @@ envBase.kitn = {} envBase._G, envBase.load = nil do ---[[propogating os yields +--[[propagating os yields when a process calls coroutine.yield(), we prepend `false` to the yielded values. os yields start with a truthy value. in coroutine.resume(), if the coroutine yielded (ie isn't dead) and the first value is truthy (ie an os yield), - we also yield the current coroutine, unwinding the current stack of running coroutines back to the os thread. + we also yield from the current coroutine, unwinding the stack of running coroutines back to the os thread. when the current coroutine is resumed, we pass the values back into the inner coroutine and repeat. ]] envBase.coroutine.yield = function(...) return kyield(false, ...) end @@ -30,9 +30,9 @@ do end function forwardYield(co, ok, ...) - if co_status(co) ~= 'suspended' then --it's not a sysyield if the coroutine didn't yield (because it returned/errored) + if co_status(co) ~= 'suspended' then --not an os yield if the coroutine didn't yield (because it returned/errored) return ok, ... - elseif (...) then --firest arg is truthy for os yield, false for coroutine.yield() + elseif (...) then --first arg is truthy for os yield, false for coroutine.yield() --yield to the scheduler, pass the results (ie signal) back to `co`, then repeat for `co`'s next yield return forwardYield(co, kresume(co, kyield(...))) else --`co` called coroutine.yield(), so return its values to the waiting coroutine.resume()