vault class GuardThe Guard type is the basic synchronization primitive in Guardian.
It provides mutual exclusion for asynchronous tasks.
Guard is in the Prelude, meaning it is always available and does not need to be imported.
Static methods for enqueueing asynchronous tasks on other Guard-based types
(e.g., GuardVar and Cond) also live in this class, as
well as static methods for constructing new Cond objects.
new()Constructs a new Guard.
runGuarded(g: Guard, task: () -> void) -> Fut<void>Enqueues task to be run when g can be acquired.
runGuarded(g1: Guard, g2: Guard, ..., gN: Guard, task: () -> void) -> Fut<void>Enqueues task to be run when all g1, g2, ..., gN can be acquired.
runGuarded(gs: GuardSet, task: () -> void) -> Fut<void>Enqueues task to be run when guards in gs can be acquired.
runGuarded<T>(gv: GuardVar<T>, task: (Var<T>) -> void) -> Fut<void>Enqueues task to be run when gv can be acquired. The task will have access to the value in gv.
runGuarded<T1, T2, ..., Tn>(gv1: GuardVar<T1>, gv2: GuardVar<T2>, ..., gvn: GuardVar<Tn>, task: (Var<T1>, Var<T2>, ..., Var<Tn>) -> void) -> Fut<void>Enqueues task to be run when all gv1, gv2, ..., gvn can be acquired. The task will have access to the values in each GuardVar.
newCondition<T1, T2, ..., Tn>(gv1: GuardVar<T1>, gv2: GuardVar<T2>, ..., gvn: GuardVar<Tn>) -> Cond<(Var<T1>, Var<T2>, ..., Var<Tn>) -> bool>Creates a new Cond object for the given GuardVars.
runCondition<T1, T2, ..., Tn>(c: Cond<(Var<T1>, Var<T2>, ..., Var<Tn>) -> bool>, task: (Var<T1>, Var<T2>, ..., Var<Tn>) -> bool) -> Fut<void>Enqueues task on the condition variable c. Returns a future that will be completed when the task indicates success.