package kcas
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module KcasSource
Type of shared memory reference
Type of compare and swap value
The type of CAS result.
ref x returns a reference on a shared memory ceils containing the value x
mk_cas a o n returns a new CAS value, which when performed, updates the reference a to n if the current content of a is o
set r n updates the reference r to value n directly. Not Safe to use with shared memory !
cas r e u updates the reference r to value u if the current content of r is e.
kCAS l performs a lock-free multi-word CAS and returns true if the multi-word CAS is successful.
kCAS requires ref of provided operations to follow a global total order. To eliminate a class of bugs kCAS presorts provided operations. If the operations are given in either ascending or descending order of get_id then the presort is done in linear time O(n). Otherwise presort may take linearithmic time O(n log n).
try_map r f invokes f c, where c is the result of get r. If the result of f c is None, then Aborted is returned. If the result of f c is Some v, then attempt to CAS update r from c to v. If the CAS succeeds, then Success c is returned. If the CAS fails, then Failed is returned.
Like try_map but retries on CAS failure. Hence, map r f never returns Failed.