OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-atocou.ads] - Blame information for rev 706

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
31
 
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
39
 
40
--  Why isn't this package available to application programs???
41
 
42
package System.Atomic_Counters is
43
 
44
   pragma Preelaborate;
45
 
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.
51
   --
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.
55
 
56
   procedure Increment (Item : in out Atomic_Counter);
57
   pragma Inline_Always (Increment);
58
   --  Increments value of atomic counter.
59
 
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.
63
 
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.
67
 
68
private
69
 
70
   type Unsigned_32 is mod 2 ** 32;
71
 
72
   type Atomic_Counter is limited record
73
      Value : aliased Unsigned_32 := 1;
74
      pragma Atomic (Value);
75
   end record;
76
 
77
end System.Atomic_Counters;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.