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:
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
| Name | Type |
|---|---|
cond | bool |
Effects
none declared (pure unless the body says otherwise)
Defined in: std/stm/stm.oxl:185