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

C.6.3 The Package System.Atomic_Operations.Test_and_Set

1/5
The language-defined package System.Atomic_Operations.Test_And_Set provides an operation to atomically set and clear an atomic flag object.

Static Semantics

2/5
The library package System.Atomic_Operations.Test_And_Set has the following declaration:
3/5
package System.Atomic_Operations.Test_And_Set
   with Pure, Nonblocking is
4/5
   type Test_And_Set_Flag is mod implementation-defined
      with Atomic, Default_Value => 0, Size => implementation-defined;
5/5
   function Atomic_Test_And_Set
     (Item : aliased in out Test_And_Set_Flag) return Boolean
      with Convention => Intrinsic;
6/5
   procedure Atomic_Clear
     (Item : aliased in out Test_And_Set_Flag)
      with Convention => Intrinsic;
7/5
   function Is_Lock_Free
     (Item : aliased Test_And_Set_Flag) return Boolean
      with Convention => Intrinsic;
8/5
end System.Atomic_Operations.Test_And_Set;
9/5
Test_And_Set_Flag represents the state of an atomic flag object. An atomic flag object can either be considered to be set or cleared.
10/5
Atomic_Test_And_Set performs an atomic test-and-set operation on Item. Item is set to some implementation-defined nonzero value. The function returns True if the previous contents were nonzero, and otherwise returns False.
11/5
Atomic_Clear performs an atomic clear operation on Item. After the operation, Item contains 0. This call should be used in conjunction with Atomic_Test_And_Set.

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