atomic-primops-0.2.2: A safe approach to CAS and other atomic ops in Haskell.

Safe HaskellNone

Data.Atomics.Internal

Description

This module provides only the raw primops (and necessary types) for atomic operations.

Synopsis

Documentation

casArray# :: MutableArray# RealWorld a -> Int# -> Ticket a -> Ticket a -> State# RealWorld -> (#State# RealWorld, Int#, Ticket a#)Source

Unsafe, machine-level atomic compare and swap on an element within an Array.

type Ticket a = Any aSource

When performing compare-and-swaps, the ticket encapsulates proof that a thread observed a specific previous value of a mutable variable. It is provided in lieu of the old value to compare-and-swap.