Module Accumulator.Tx

Transactions on accumulators.

val add : t -> int -> unit Kcas.Tx.t

add a n increments the value of the accumulator a by n. add operations can be performed scalably in parallel.

val incr : t -> unit Kcas.Tx.t

incr a is equivalent to add a 1.

val decr : t -> unit Kcas.Tx.t

decr a is equivalent to add a (-1).

val get : t -> int Kcas.Tx.t

get a returns the current value of the accumulator.

CAUTION: Performing a get is expensive and can limit scalability.

val set : t -> int -> unit Kcas.Tx.t

set a n sets the current value of the accumulator a to n.