def with_lock

cswap-bend-cli@0.1.0.0 · lock.bend:106

import cswap-bend-cli@0.1.0.0/lock.bend as Lock
import Base
import cswap-bend-cli@0.1.0.0/fs.bend as Fs

106# Run `act` while holding the lock; the lock is released afterwards whatever
107# `act` answers. A timeout is Fail{(11, "Failed to acquire lock ...")}.
108def with_lock(-A: Type, path: String, timeout_ms: U32, act: IO(Fs.Res(A))) -> IO(Fs.Res(A)):
109  IO.bind(Fs.Res(Maybe<&1, File>), Fs.Res(A), acquire(path, timeout_ms), m => held.run(A, act, m))

Uses (9)

Used by (8)