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-2019, 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------------------------------------------------------------------------------ 31 32-- This package provides support for the body of Ada.Task_Attributes 33 34with Ada.Unchecked_Conversion; 35 36package System.Tasking.Task_Attributes is 37 38 type Deallocator is access procedure (Ptr : Atomic_Address); 39 pragma Favor_Top_Level (Deallocator); 40 41 type Attribute_Record is record 42 Free : Deallocator; 43 end record; 44 -- The real type is declared in Ada.Task_Attributes body: Real_Attribute. 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; 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. 58 59 function Require_Finalization (Index : Integer) return Boolean; 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. 64 65 procedure Finalize (Index : Integer); 66 -- Finalize given Index, possibly allowing future reuse 67 68private 69 pragma Inline (Finalize); 70 pragma Inline (Require_Finalization); 71end System.Tasking.Task_Attributes; 72