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).
procedure Add (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
function Add_Fetch (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Add_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function And_Fetch (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure And_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
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
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)
function Exchange (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Exchange (This : aliased in out Instance;
Val : T;
Old : out T;
Order : Mem_Order := Seq_Cst)
function Fetch_Add (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Fetch_Add (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function Fetch_And (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Fetch_And (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function Fetch_NAND (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Fetch_NAND (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function Fetch_OR (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Fetch_OR (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function Fetch_Sub (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Fetch_Sub (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function Fetch_XOR (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Fetch_XOR (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
function Init (Val : T) return Instance
Can be used to initialize an atomic instance:
A : Atomic.Unsigned_8.Instance := Atomic.Unsigned_8.Init (0);
type Instance is limited private;
This type is limited and private, it can only be manipulated using the primitives below.
function Load (This : aliased Instance;
Order : Mem_Order := Seq_Cst)
return T
procedure NAND (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
function NAND_Fetch (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure NAND_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
procedure Op_And (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
procedure Op_OR (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
procedure Op_XOR (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
function OR_Fetch (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure OR_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
procedure Store (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
procedure Sub (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
function Sub_Fetch (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure Sub_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
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.
function XOR_Fetch (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
procedure XOR_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)