C.6.3 The Package System.Atomic_Operations.Test_and_Set
The language-defined package System.Atomic_Operations.Test_And_Set
provides an operation to atomically set and clear an atomic flag object.
Static Semantics
The library package
System.Atomic_Operations.Test_And_Set has the following declaration:
package System.Atomic_Operations.Test_And_Set
with Pure, Nonblocking
is
type Test_And_Set_Flag
is mod implementation-defined
with Atomic, Default_Value => 0, Size =>
implementation-defined;
function Atomic_Test_And_Set
(Item :
aliased in out Test_And_Set_Flag)
return Boolean
with Convention => Intrinsic;
procedure Atomic_Clear
(Item :
aliased in out Test_And_Set_Flag)
with Convention => Intrinsic;
function Is_Lock_Free
(Item :
aliased Test_And_Set_Flag)
return Boolean
with Convention => Intrinsic;
end System.Atomic_Operations.Test_And_Set;
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.
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.
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.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe