def wait
import cswap-bend-cli@0.1.0.0/dirlock.bend as Dirlockimport Base
import cswap-bend-cli@0.1.0.0/act.bend as Act
72# Wait for the lock `fuel` more times, taking over a stale one.
73def wait(+fuel: Nat, +dir: String, +staleness: U32, +got: Bool) -> Act.of(Unit):
74 match fuel got:
75 case _ True{}:
76 Act.pure(Unit, Unit{})
77 case 0n False{}:
78 Act.fail(Unit, 4, busy_msg(dir))
79 case 1n++p False{}:
80 do ActM<Unit>:
81 again : Bool <- retake(dir, staleness)
82 wait(p, dir, staleness, again)