tur/stm
stdlib/stm.tur
defn
ptr/null
(ptr/null :ptr)
return a null pointer constant.
Since: Phase 20
defn
tvar/new
(tvar/new [init] :ptr)
create a new transactional variable with an initial value.
Parameters
| init | initial integer value stored in the TVar |
Since: Phase 20
defn
tvar/read
(tvar/read [tv :ptr] :ptr)
read the current value of a TVar within the active transaction.
Parameters
| tv | TVar handle returned by tvar/new |
Since: Phase 20
defn
tvar/write
(tvar/write [tv :ptr val :ptr] :nil)
write a new value to a TVar within the active transaction.
Parameters
| tv | TVar handle returned by tvar/new | |
| val | new value to record in the transaction log |
Since: Phase 20
defn
tvar/swap
(tvar/swap [tv :ptr new :ptr] :ptr)
atomically replace a TVar's value and return the old value.
Parameters
| tv | TVar handle returned by tvar/new | |
| new | replacement value |
Since: Phase 20
defn
tvar/cas
(tvar/cas [tv :ptr old :ptr new :ptr] :bool)
compare-and-swap a TVar within the active transaction.
Parameters
| tv | TVar handle returned by tvar/new | |
| old | expected current value | |
| new | desired replacement value |
Since: Phase 21