]>
Commit | Line | Data |
---|---|---|
cacbc350 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3084fecd | 3 | -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- |
cacbc350 RK |
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 | -- -- | |
4b490c1e | 9 | -- Copyright (C) 2014-2020, Free Software Foundation, Inc. -- |
cacbc350 | 10 | -- -- |
607d0635 | 11 | -- GNAT is free software; you can redistribute it and/or modify it under -- |
cacbc350 | 12 | -- terms of the GNU General Public License as published by the Free Soft- -- |
607d0635 AC |
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- -- | |
cacbc350 | 15 | -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
607d0635 AC |
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/>. -- | |
cacbc350 | 26 | -- -- |
fbf5a39b AC |
27 | -- GNARL was developed by the GNARL team at Florida State University. -- |
28 | -- Extensive contributions were provided by Ada Core Technologies, Inc. -- | |
cacbc350 RK |
29 | -- -- |
30 | ------------------------------------------------------------------------------ | |
31 | ||
1a49cf99 | 32 | -- This package provides support for the body of Ada.Task_Attributes |
cacbc350 | 33 | |
8071b771 | 34 | with Ada.Unchecked_Conversion; |
cacbc350 RK |
35 | |
36 | package System.Tasking.Task_Attributes is | |
37 | ||
8071b771 | 38 | type Deallocator is access procedure (Ptr : Atomic_Address); |
c1c3784b | 39 | pragma Favor_Top_Level (Deallocator); |
cacbc350 | 40 | |
8071b771 AC |
41 | type Attribute_Record is record |
42 | Free : Deallocator; | |
cacbc350 | 43 | end record; |
2afa8fdd | 44 | -- The real type is declared in Ada.Task_Attributes body: Real_Attribute. |
8071b771 AC |
45 | -- As long as the first field is the deallocator we are good. |
46 | ||
47 | type Attribute_Access is access all Attribute_Record; | |
48 | pragma No_Strict_Aliasing (Attribute_Access); | |
49 | ||
50 | function To_Attribute is new | |
51 | Ada.Unchecked_Conversion (Atomic_Address, Attribute_Access); | |
52 | ||
53 | function Next_Index (Require_Finalization : Boolean) return Integer; | |
3aac5551 RD |
54 | -- Return the next attribute index available. Require_Finalization is True |
55 | -- if the attribute requires finalization and in particular its deallocator | |
56 | -- (Free field in Attribute_Record) should be called. Raise Storage_Error | |
57 | -- if no index is available. | |
8071b771 AC |
58 | |
59 | function Require_Finalization (Index : Integer) return Boolean; | |
3aac5551 RD |
60 | -- Return True if a given attribute index requires call to Free. This call |
61 | -- is not protected against concurrent access, should only be called during | |
62 | -- finalization of the corresponding instantiation of Ada.Task_Attributes, | |
63 | -- or during finalization of a task. | |
8071b771 AC |
64 | |
65 | procedure Finalize (Index : Integer); | |
66 | -- Finalize given Index, possibly allowing future reuse | |
67 | ||
68 | private | |
69 | pragma Inline (Finalize); | |
70 | pragma Inline (Require_Finalization); | |
cacbc350 | 71 | end System.Tasking.Task_Attributes; |