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.

initinitial 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.

tvTVar 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.

tvTVar handle returned by tvar/new
valnew 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.

tvTVar handle returned by tvar/new
newreplacement 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.

tvTVar handle returned by tvar/new
oldexpected current value
newdesired replacement value

Since: Phase 21