Concurrency Coordination Reports
Fiber Resume Coordination Report
Resume a fiber to read the checkpoint it reports and label the reached stage.
fiber resume
`Fiber#resume` runs a fiber until its `Fiber.yield` and returns the yielded value, so resuming the fiber reads the checkpoint it reports for the selected stage while the fiber stays suspended and no background work keeps running.
Fiber Resume Coordination Report
fiber_resume_coordination_report.rb
Replay: real traced execution (multi-file project)
checkpoint = 1
labels = ["first", "second", "done"]
sequence = Fiber.new do
Fiber.yield(labels.fetch(checkpoint - 1))
"closed"
end
reached = sequence.resume
alive = sequence.alive?
status = reached
puts "checkpoint=#{checkpoint}"
puts "reached=#{reached}"
puts "alive=#{alive}"
puts "status=#{status}"
checkpoint = 2
labels = ["first", "second", "done"]
sequence = Fiber.new do
Fiber.yield(labels.fetch(checkpoint - 1))
"closed"
end
reached = sequence.resume
alive = sequence.alive?
status = reached
puts "checkpoint=#{checkpoint}"
puts "reached=#{reached}"
puts "alive=#{alive}"
puts "status=#{status}"
checkpoint = 3
labels = ["first", "second", "done"]
sequence = Fiber.new do
Fiber.yield(labels.fetch(checkpoint - 1))
"closed"
end
reached = sequence.resume
alive = sequence.alive?
status = reached
puts "checkpoint=#{checkpoint}"
puts "reached=#{reached}"
puts "alive=#{alive}"
puts "status=#{status}"
checkpoint ← 1, labels ← ["first", "second", "done"], sequence ← ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩
1checkpoint→ 1 = 1 #@checkpoint=2, 32labels→ ["first", "second", "done"] = ["first", "second", "done"]3sequence→ ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩ = Fiber.new do4 Fiber.yield(labels.fetch(checkpoint - 1))5 "closed"6end78reached = sequence⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩.resume9alive = sequence.alive?sequence ← ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (suspended)⟩
8reached→ first = sequence→ ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (suspended)⟩.resume9alive→ true = sequence.alive?true10status→ first = reachedfirst1112puts "checkpoint=#{checkpoint1}"13puts "reached=#{reachedfirst}"14puts "alive=#{alivetrue}"15puts "status=#{statusfirst}"outputcheckpoint=1 reached=first alive=true status=first
checkpoint ← 2, labels ← ["first", "second", "done"], sequence ← ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩
1checkpoint→ 2 = 22labels→ ["first", "second", "done"] = ["first", "second", "done"]3sequence→ ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩ = Fiber.new do4 Fiber.yield(labels.fetch(checkpoint - 1))5 "closed"6end78reached = sequence⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩.resume9alive = sequence.alive?sequence ← ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (suspended)⟩
8reached→ second = sequence→ ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (suspended)⟩.resume9alive→ true = sequence.alive?true10status→ second = reachedsecond1112puts "checkpoint=#{checkpoint2}"13puts "reached=#{reachedsecond}"14puts "alive=#{alivetrue}"15puts "status=#{statussecond}"outputcheckpoint=2 reached=second alive=true status=second
checkpoint ← 3, labels ← ["first", "second", "done"], sequence ← ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩
1checkpoint→ 3 = 32labels→ ["first", "second", "done"] = ["first", "second", "done"]3sequence→ ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩ = Fiber.new do4 Fiber.yield(labels.fetch(checkpoint - 1))5 "closed"6end78reached = sequence⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (created)⟩.resume9alive = sequence.alive?sequence ← ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (suspended)⟩
8reached→ done = sequence→ ⟨Fiber A /tmp/execution/⟨tmp B⟩.rb:40 (suspended)⟩.resume9alive→ true = sequence.alive?true10status→ done = reacheddone1112puts "checkpoint=#{checkpoint3}"13puts "reached=#{reacheddone}"14puts "alive=#{alivetrue}"15puts "status=#{statusdone}"outputcheckpoint=3 reached=done alive=true status=done