# 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