Atomic.Signed

Entities

Simple Types

Subprograms

Description

Based on GCC atomic built-ins. See: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

The specification is exactly the same for all sizes of data (8, 16, 32, 64).

Add

procedure Add (This  : aliased in out Instance;
               Val   : T;
               Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Order

Add_Fetch

function Add_Fetch (This  : aliased in out Instance;
                    Val   : T;
                    Order : Mem_Order := Seq_Cst)
                    return T
Parameters
This
Val
Order
Return Value

Add_Fetch

procedure Add_Fetch (This  : aliased in out Instance;
                     Val   : T;
                     Result : out T;
                     Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Result
Order

Compare_Exchange

function Compare_Exchange (This          : aliased in out Instance;
                           Expected      : T;
                           Desired       : T;
                           Weak          : Boolean;
                           Success_Order : Mem_Order := Seq_Cst;
                           Failure_Order : Mem_Order := Seq_Cst)
                           return Boolean
Parameters
This
Expected
Desired
Weak
Success_Order
Failure_Order
Return Value

Compare_Exchange

procedure Compare_Exchange (This          : aliased in out Instance;
                            Expected      : T;
                            Desired       : T;
                            Weak          : Boolean;
                            Success       : out Boolean;
                            Success_Order : Mem_Order := Seq_Cst;
                            Failure_Order : Mem_Order := Seq_Cst)
Parameters
This
Expected
Desired
Weak
Success
Success_Order
Failure_Order

Exchange

function Exchange (This  : aliased in out Instance;
                   Val   : T;
                   Order : Mem_Order := Seq_Cst)
                   return T
Parameters
This
Val
Order
Return Value

Exchange

procedure Exchange (This  : aliased in out Instance;
                    Val   : T;
                    Old   : out T;
                    Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Old
Order

Fetch_Add

function Fetch_Add (This  : aliased in out Instance;
                    Val   : T;
                    Order : Mem_Order := Seq_Cst)
                    return T
Parameters
This
Val
Order
Return Value

Fetch_Add

procedure Fetch_Add (This  : aliased in out Instance;
                     Val   : T;
                     Result : out T;
                     Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Result
Order

Fetch_Sub

function Fetch_Sub (This  : aliased in out Instance;
                    Val   : T;
                    Order : Mem_Order := Seq_Cst)
                    return T
Parameters
This
Val
Order
Return Value

Fetch_Sub

procedure Fetch_Sub (This  : aliased in out Instance;
                    Val   : T;
                     Result : out T;
                     Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Result
Order

Init

function Init (Val : T) return Instance

Can be used to initialize an atomic instance:

A : Atomic.Unsigned_8.Instance := Atomic.Unsigned_8.Init (0);

Parameters
Val
Return Value

Instance

type Instance is limited private;

This type is limited and private, it can only be manipulated using the primitives below.

Load

function Load (This  : aliased Instance;
               Order : Mem_Order := Seq_Cst)
               return T
Parameters
This
Order
Return Value

Store

procedure Store (This  : aliased in out Instance;
                 Val   : T;
                 Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Order

Sub

procedure Sub (This  : aliased in out Instance;
               Val   : T;
               Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Order

Sub_Fetch

function Sub_Fetch (This  : aliased in out Instance;
                    Val   : T;
                    Order : Mem_Order := Seq_Cst)
                    return T
Parameters
This
Val
Order
Return Value

Sub_Fetch

procedure Sub_Fetch (This  : aliased in out Instance;
                    Val   : T;
                     Result : out T;
                     Order : Mem_Order := Seq_Cst)
Parameters
This
Val
Result
Order

Value

function Value (This : Instance) return T

Ghost function to get the value of an instance without needing it aliased. This function can be used in contracts for instance. This doesn't use the atomic built-ins.

Parameters
This
Return Value