File : s-taspri-xi.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
   4 --                                                                          --
   5 --                 S Y S T E M . T A S K _ P R I M I T I V E S              --
   6 --                                                                          --
   7 --                                  S p e c                                 --
   8 --                                                                          --
   9 --          Copyright (C) 2001-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 is the version of this package for Ravenscar bare board targets
  33 
  34 pragma Polling (Off);
  35 --  Turn off polling, we do not want ATC polling to take place during tasking
  36 --  operations. It causes infinite loops and other problems.
  37 
  38 with System.OS_Interface;
  39 
  40 package System.Task_Primitives is
  41    pragma Preelaborate;
  42 
  43    type Task_Body_Access is access procedure;
  44    --  Pointer to the task body's entry point (or possibly a wrapper
  45    --  declared local to the GNARL).
  46 
  47    type Private_Data is limited private;
  48    --  Any information that the GNULLI needs maintained on a per-task
  49    --  basis.  A component of this type is guaranteed to be included
  50    --  in the Ada_Task_Control_Block.
  51 
  52    subtype Task_Address is System.Address;
  53    Task_Address_Size : constant := Standard'Address_Size;
  54    --  Type used for task addresses and its size
  55 
  56    Alternate_Stack_Size : constant := 0;
  57    --  No alternate signal stack is used on this platform
  58 
  59 private
  60 
  61    type Private_Data is limited record
  62       Thread_Desc : aliased System.OS_Interface.Thread_Descriptor;
  63       --  Thread descriptor associated to the ATCB to which it belongs
  64 
  65       Thread : aliased System.OS_Interface.Thread_Id :=
  66                  System.OS_Interface.Null_Thread_Id;
  67       --  Thread Id associated to the ATCB to which it belongs.
  68       --  ??? It is mostly used by GDB, so we may want to remove it at some
  69       --  point.
  70       pragma Atomic (Thread);
  71       --  Thread field may be updated by two different threads of control.
  72       --  (See, Enter_Task and Create_Task in s-taprop.adb).
  73       --  They put the same value (thr_self value). We do not want to
  74       --  use lock on those operations and the only thing we have to
  75       --  make sure is that they are updated in atomic fashion.
  76 
  77       Lwp : aliased System.Address := System.Null_Address;
  78       --  This element duplicates the Thread element. It is read by gdb when
  79       --  the remote protocol is used.
  80    end record;
  81 
  82 end System.Task_Primitives;