2015-09-28 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / ada / s-tataat.ads
blob2dd5f5e67870405014368b56e30f073dd8cd2521
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . T A S K I N G . T A S K _ A T T R I B U T E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2014, Free Software Foundation, Inc. --
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 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package provides support for the body of Ada.Task_Attributes
34 with Ada.Unchecked_Conversion;
36 package System.Tasking.Task_Attributes is
38 type Deallocator is access procedure (Ptr : Atomic_Address);
40 type Attribute_Record is record
41 Free : Deallocator;
42 end record;
43 -- The real type is declared in Ada.Task_Attributes body: Real_Attribute.
44 -- As long as the first field is the deallocator we are good.
46 type Attribute_Access is access all Attribute_Record;
47 pragma No_Strict_Aliasing (Attribute_Access);
49 function To_Attribute is new
50 Ada.Unchecked_Conversion (Atomic_Address, Attribute_Access);
52 function Next_Index (Require_Finalization : Boolean) return Integer;
53 -- Return the next attribute index available. Require_Finalization is True
54 -- if the attribute requires finalization and in particular its deallocator
55 -- (Free field in Attribute_Record) should be called. Raise Storage_Error
56 -- if no index is available.
58 function Require_Finalization (Index : Integer) return Boolean;
59 -- Return True if a given attribute index requires call to Free. This call
60 -- is not protected against concurrent access, should only be called during
61 -- finalization of the corresponding instantiation of Ada.Task_Attributes,
62 -- or during finalization of a task.
64 procedure Finalize (Index : Integer);
65 -- Finalize given Index, possibly allowing future reuse
67 private
68 pragma Inline (Finalize);
69 pragma Inline (Require_Finalization);
70 end System.Tasking.Task_Attributes;