C.6.3 The Package System.Atomic_Operations.Test_and_Set
{
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
{
AI12-0321-1}
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;
Implementation defined: The modulus and
size of Test_and_Set_Flag.
{
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.
{
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.
Implementation defined: The value used
to represent the set value for Atomic_Test_and_Set.
{
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
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe