Ada Reference Manual (Ada 2022)Legal Information
Contents   Index   References   Search   Previous   Next 

C.6.4 The Package System.Atomic_Operations.Integer_Arithmetic

1/5
The language-defined generic package System.Atomic_Operations.Integer_Arithmetic provides operations to perform arithmetic atomically on objects of integer types. 

Static Semantics

2/5
The generic library package System.Atomic_Operations.Integer_Arithmetic has the following declaration:
3/5
generic
   type Atomic_Type is range <> with Atomic;
package System.Atomic_Operations.Integer_Arithmetic
   with Pure, Nonblocking is
4/5
   procedure Atomic_Add (Item  : aliased in out Atomic_Type;
                         Value : Atomic_Type)
      with Convention => Intrinsic;
5/5
   procedure Atomic_Subtract (Item  : aliased in out Atomic_Type;
                              Value : Atomic_Type)
      with Convention => Intrinsic;
6/5
   function Atomic_Fetch_And_Add
     (Item  : aliased in out Atomic_Type;
      Value : Atomic_Type) return Atomic_Type
      with Convention => Intrinsic;
7/5
   function Atomic_Fetch_And_Subtract
     (Item  : aliased in out Atomic_Type;
      Value : Atomic_Type) return Atomic_Type
      with Convention => Intrinsic;
8/5
   function Is_Lock_Free (Item : aliased Atomic_Type) return Boolean
      with Convention => Intrinsic;
9/5
end System.Atomic_Operations.Integer_Arithmetic;
10/5
The operations of this package are defined as follows:
11/5
procedure Atomic_Add (Item  : aliased in out Atomic_Type;
                      Value : Atomic_Type)
   with Convention => Intrinsic;
12/5
Atomically performs: Item := Item + Value;
13/5
procedure Atomic_Subtract (Item  : aliased in out Atomic_Type;
                           Value : Atomic_Type)
   with Convention => Intrinsic;
14/5
Atomically performs: Item := Item - Value;
15/5
function Atomic_Fetch_And_Add
  (Item  : aliased in out Atomic_Type;
   Value : Atomic_Type) return Atomic_Type
   with Convention => Intrinsic;
16/5
Atomically performs: Tmp := Item; Item := Item + Value; return Tmp;
17/5
function Atomic_Fetch_And_Subtract
  (Item  : aliased in out Atomic_Type;
   Value : Atomic_Type) return Atomic_Type
   with Convention => Intrinsic;
18/5
Atomically performs: Tmp := Item; Item := Item - Value; return Tmp;

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe