Annotated Ada Reference Manual (Ada 202y Draft 1)Legal Information
Contents   Index   References   Search   Previous   Next 

C.6.3 The Package System.Atomic_Operations.Test_and_Set

1/5
{AI12-0321-1} 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
{AI12-0321-1} 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;
8.a/5
Implementation defined: The modulus and size of Test_and_Set_Flag.
9/5
{AI12-0321-1} 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
{AI12-0321-1} 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.
10.a/5
Implementation defined: The value used to represent the set value for Atomic_Test_and_Set.
11/5
{AI12-0321-1} 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.

Extensions to Ada 2012

11.a/5
{AI12-0321-1} This package is new. 

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