OxL Reference

fn check

Inside atomic { }: when cond is false the transaction is abandoned, the task waits (without holding a thread, and it can be cancelled) until a TVar the transaction has read changes, and the block runs again.

Example:

oxl✓ checked in CI
use std.stm { TVar, check }

fn main() io {
  let ready = TVar(true)
  atomic {
    check(ready.get())
  }
  print("passed")
}
Output
passed
pub(api) fn check(cond: bool)

Since. 1.0.0-beta

Parameters

NameType
condbool

Effects

none declared (pure unless the body says otherwise)

Defined in: std/stm/stm.oxl:185

See also