Function stm_core::guard [] [src]

pub fn guard(cond: bool) -> StmResult<()>

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);