Concurrency Coordination Reports
Checkpoint Resume Coordination Report
Resume a coroutine through a fixed number of ordered checkpoints and report the resume sequence and drain state.
Checkpoint Resume Coordination Report
checkpoint_resume.lua
local seed =
local checkpoints = 0
local order = ""
for i = 1, seed do
checkpoints = checkpoints + 1
order = order .. i
end
local report_status = "idle"
if checkpoints >= 3 then
report_status = "drained"
elseif checkpoints == 2 then
report_status = "checked"
elseif checkpoints == 1 then
report_status = "primed"
end
print("seed=" .. seed .. " checkpoints=" .. checkpoints .. " order=" .. order .. " status=" .. report_status)
local seed =
local checkpoints = 0
local order = ""
for i = 1, seed do
checkpoints = checkpoints + 1
order = order .. i
end
local report_status = "idle"
if checkpoints >= 3 then
report_status = "drained"
elseif checkpoints == 2 then
report_status = "checked"
elseif checkpoints == 1 then
report_status = "primed"
end
print("seed=" .. seed .. " checkpoints=" .. checkpoints .. " order=" .. order .. " status=" .. report_status)
local seed =
local checkpoints = 0
local order = ""
for i = 1, seed do
checkpoints = checkpoints + 1
order = order .. i
end
local report_status = "idle"
if checkpoints >= 3 then
report_status = "drained"
elseif checkpoints == 2 then
report_status = "checked"
elseif checkpoints == 1 then
report_status = "primed"
end
print("seed=" .. seed .. " checkpoints=" .. checkpoints .. " order=" .. order .. " status=" .. report_status)
checkpoint resume
Each coroutine yield marks an ordered checkpoint that resumes in sequence, so the checkpoint count and resume order stay deterministic.