Atomic

Entities

Simple Types

Subprograms

Description

Clear

procedure Clear (This : aliased in out Flag;
                 Order : Mem_Order := Seq_Cst)
Parameters
This
Order

Flag

type Flag is limited private;

Init

function Init (Val : Boolean) return Flag

Can be used to initialize an Atomic_Flag:

A : Atomic.Flag := Atomic.Init (0);

Parameters
Val
Return Value

Mem_Order

type Mem_Order is
  (Relaxed,
   Consume,
   Acquire,
   Release,
   Acq_Rel,
   Seq_Cst);
Enumeration Literal
Relaxed

Implies no inter-thread ordering constraints

Consume

This is currently implemented using the stronger __ATOMIC_ACQUIRE memory order because of a deficiency in C++11's semantics for memory_order_consume.

Acquire

Creates an inter-thread happens-before constraint from the release (or stronger) semantic store to this acquire load. Can prevent hoisting of code to before the operation.

Release

Creates an inter-thread happens-before constraint to acquire (or stronger) semantic loads that read from this release store. Can prevent sinking of code to after the operation.

Acq_Rel

Combines the effects of both Acquire and Release

Seq_Cst

Enforces total ordering with all other Seq_Cst operations

Set

function Set (This  : aliased Flag;
              Order : Mem_Order := Seq_Cst)
              return Boolean
Parameters
This
Order
Return Value

Stronger

function Stronger (A, B : Mem_Order) return Boolean
Parameters
A
B
Return Value

Test_And_Set

procedure Test_And_Set (This   : aliased in out Flag;
                        Result : out Boolean;
                        Order  : Mem_Order := Seq_Cst)
Parameters
This
Result
Order

Value

function Value (This : Flag) return Boolean

Ghost function to get the value of an Flag without needing it aliased. This doesn't use the atomic built-ins.

Parameters
This
Return Value