# Heal a little each second until full — but cap the total nap with a timeout.
# Whichever finishes first wins; race cancels the other.
race:
block:
Sleep(MaxSleepDuration) # the cap: nap no longer than this
loop:
if (CurrentHealth < MaxHealth):
Heal(InAgent)
Sleep(1.0)
else:
break # fully healed → this arm completes
Verse Library
verse
12 Fragment
Races a conditional loop against a fixed duration to safely cap operation time.
verse-library/verse-concurrency-async-race-state-machines/12-fragment.verse