No matching definitions.

tur/stm

stdlib/stm.tur

Software Transactional Memory: transactional read/write on TVars.

Since: Phase 20

defn

ptr/null

(ptr/null)

return a null pointer constant.

A :ptr value equal to NULL.

(ptr/null)  ; => ptr (NULL)

Since: Phase 20

defn

tvar/new

(tvar/new [init])

create a new transactional variable with an initial value.

initinitial integer value stored in the TVar

An opaque ptr handle to the newly allocated TVar.

(let [tv (tvar/new 0)] ...)  ; => ptr

Since: Phase 20

defn

tvar/read

(tvar/read [tv :ptr])

read the current value of a TVar within the active transaction.

tvTVar handle returned by tvar/new

The current transactional value as a ptr.

(tvar/read tv)  ; => ptr

Since: Phase 20

defn

tvar/write

(tvar/write [tv :ptr val :ptr])

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
(tvar/write tv new-val)

Since: Phase 20

defn

tvar/swap

(tvar/swap [tv :ptr new :ptr])

atomically replace a TVar's value and return the old value.

tvTVar handle returned by tvar/new
newreplacement value

The previous value of the TVar within the current transaction.

(tvar/swap tv new-val)  ; => ptr (old value)

Since: Phase 20

defn

tvar/cas

(tvar/cas [tv :ptr old :ptr new :ptr])

compare-and-swap a TVar within the active transaction.

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

true if the swap was recorded (old matched); false otherwise.

(tvar/cas tv expected new-val)  ; => bool

Since: Phase 21