pub fn guard(cond: bool) -> StmResult<()>
Expand description
Retry until cond
is true.
ยงExample
let var = TVar::new(42);
let x = atomically(|tx| {
let v = var.read(tx)?;
guard(v==42)?;
// v is now always 42.
Ok(v)
});
assert_eq!(x, 42);