package kcas

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Operations on shared memory locations.

type t

Type of operations on shared memory locations.

val make_cas : 'a Loc.t -> 'a -> 'a -> t

make_cas r before after is an operation that attempts to set the shared memory location r to the after value and succeeds if the current content of r is the before value.

val is_on_loc : t -> 'a Loc.t -> bool

is_on_loc op r determines whether the target of op is the shared memory location r.

val atomic : t -> bool

atomic op attempts to perform the given operation atomically. Returns true on success and false on failure.

val atomically : t list -> bool

atomically ops attempts to perform the given operations atomically. Returns true on success and false on failure.

The algorithm requires provided operations to follow a global total order. To eliminate a class of bugs, the operations are sorted automatically. If the operations are given in either ascending or descending order of the targeted shared memory location ids, then sorting is done in linear time O(n) and does not increase the time complexity of the algorithm. Otherwise sorting may take linearithmic time O(n*log(n)).

OCaml

Innovation. Community. Security.