Implement -mmemcpy-strategy= and -mmemset-strategy= options
[official-gcc.git] / gcc / ada / s-atocou.ads
blobcad18d29896e883232a0c1648c88f34a702cdbf1
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . A T O M I C _ C O U N T E R S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2011, AdaCore --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package provides atomic counter on platforms where it is supported:
33 -- - all Alpha platforms
34 -- - all ia64 platforms
35 -- - all PowerPC platforms
36 -- - all SPARC V9 platforms
37 -- - all x86 platforms
38 -- - all x86_64 platforms
40 -- Why isn't this package available to application programs???
42 package System.Atomic_Counters is
44 pragma Preelaborate;
46 type Atomic_Counter is limited private;
47 -- Type for atomic counter objects. Note, initial value of the counter is
48 -- one. This allows using an atomic counter as member of record types when
49 -- object of these types are created at library level in preelaborable
50 -- compilation units.
52 -- Atomic_Counter is declared as private limited type to provide highest
53 -- level of protection from unexpected use. All available operations are
54 -- declared below, and this set should be as small as possible.
56 procedure Increment (Item : in out Atomic_Counter);
57 pragma Inline_Always (Increment);
58 -- Increments value of atomic counter.
60 function Decrement (Item : in out Atomic_Counter) return Boolean;
61 pragma Inline_Always (Decrement);
62 -- Decrements value of atomic counter, returns True when value reach zero.
64 function Is_One (Item : Atomic_Counter) return Boolean;
65 pragma Inline_Always (Is_One);
66 -- Returns True when value of the atomic counter is one.
68 private
70 type Unsigned_32 is mod 2 ** 32;
72 type Atomic_Counter is limited record
73 Value : aliased Unsigned_32 := 1;
74 pragma Atomic (Value);
75 end record;
77 end System.Atomic_Counters;