daemon/pidlock.bend relies on unsafe/foreign
raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/pidlock.bend as Pidlock
5 imports
import Base import ../fs.bend as Fs import ../fs/write.bend as FsW import ../act.bend as Act import ../lock.bend as Lock
Definitions
def ActM source · line 12 · raw
@-A:Type -> Type
def ActM.pure source · line 15 · raw
@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def ActM.bind source · line 18 · raw
@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)
def lock_path source · line 21 · raw
@+state_dir:String -> String
def pid_path source · line 24 · raw
@+state_dir:String -> String
def pid_of source · line 27 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> U32
def my_pid source · line 35 · raw
IO(U32)
This process's pid: the parent of a child shell (Bend has no getpid).
def holder_text source · line 38 · raw
@r:0x0717344745a30ebad1f19045228e8f18/fs.Res(String) -> String
def busy_msg source · line 45 · raw
@+state_dir:String -> @+holder:String -> String
def busy_fail source · line 48 · raw
@-A:Type -> @+state_dir:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def claim source · line 51 · raw
@+state_dir:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)
def give_back source · line 56 · raw
@+state_dir:String -> @f:File -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)
def run_held source · line 61 · raw
@-A:Type -> @+state_dir:String -> @f:File -> @c:0x0717344745a30ebad1f19045228e8f18/fs.Res(Unit) -> @act:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def held source · line 68 · raw
@-A:Type -> @+state_dir:String -> @m:Maybe<&1, File> -> @act:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def with_pidlock source · line 77 · raw
@-A:Type -> @+state_dir:String -> @act:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
Run act as the one decider of this state dir. A second caller gets
Fail{(11, "Another cswap auto is already running ...")} and act never starts.