module STM:sig..end
WARNING: the current implementation has only been lightly tested.
This module provides support for a partial STM, that protects
only values of type STM.ref.
type 'a ref
val ref : 'a -> 'a refref, that can then only be accessed during
a transaction.exception Retry
exception Abort
exception Cancelled
val run : ?retries:int ->
(('a ref -> 'a) -> ('a ref -> 'a -> unit) -> 'b) -> 'brun ~retries f executes the function f inside a newly-created
transaction. Function f is passed two functions g and s that
are to be used as respectively read and write accessors to ref
values. The retries parameter (defaulting to 64 indicates how
many time a transaction should be retried.
The Retry exception can be raised to requested the current
transaction to be re-executed from the beginning, while any other
exception will cause the transaction to be aborted.
Raises Cancelled if the transaction cannot be committed, and
retries have been exhausted.
val run_read_only : ?retries:int -> (('a ref -> 'a) -> 'b) -> 'brun, but with a smaller overhead due to the fact that the
transaction is guaranteed to only read values.