File : s-tataat.ads


   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 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  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 
  34 with Ada.Unchecked_Conversion;
  35 
  36 package System.Tasking.Task_Attributes is
  37 
  38    type Deallocator is access procedure (Ptr : Atomic_Address);
  39 
  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.
  45 
  46    type Attribute_Access is access all Attribute_Record;
  47    pragma No_Strict_Aliasing (Attribute_Access);
  48 
  49    function To_Attribute is new
  50      Ada.Unchecked_Conversion (Atomic_Address, Attribute_Access);
  51 
  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.
  57 
  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.
  63 
  64    procedure Finalize (Index : Integer);
  65    --  Finalize given Index, possibly allowing future reuse
  66 
  67 private
  68    pragma Inline (Finalize);
  69    pragma Inline (Require_Finalization);
  70 end System.Tasking.Task_Attributes;