1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                       S Y S T E M . T H R E A D S                        --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 1992-2018, 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-- GNAT was originally developed  by the GNAT team at  New York University. --
28-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29--                                                                          --
30------------------------------------------------------------------------------
31
32--  This package provides facilities to register a thread to the runtime,
33--  and allocate its task specific datas.
34
35--  This package is currently implemented for:
36
37--    VxWorks AE653 rts-cert
38--    VxWorks AE653 rts-full (not rts-kernel)
39
40with Ada.Exceptions;
41with Ada.Unchecked_Conversion;
42
43with Interfaces.C;
44
45with System.Secondary_Stack;
46with System.Soft_Links;
47
48package System.Threads is
49
50   package SST renames System.Secondary_Stack;
51
52   type ATSD is limited private;
53   --  Type of the Ada thread specific data. It contains datas needed
54   --  by the GNAT runtime.
55
56   type ATSD_Access is access ATSD;
57   function From_Address is
58     new Ada.Unchecked_Conversion (Address, ATSD_Access);
59
60   subtype STATUS is Interfaces.C.int;
61   --  Equivalent of the C type STATUS
62
63   type t_id is new Interfaces.C.long;
64   subtype Thread_Id is t_id;
65
66   function Register (T : Thread_Id) return STATUS;
67   --  Create the task specific data necessary for Ada language support
68
69   --------------------------
70   -- Thread Body Handling --
71   --------------------------
72
73   --  The subprograms in this section are called from the process body
74   --  wrapper in the APEX process registration package.
75
76   procedure Thread_Body_Enter
77     (Sec_Stack_Ptr        : SST.SS_Stack_Ptr;
78      Process_ATSD_Address : System.Address);
79   --  Enter thread body, see above for details
80
81   procedure Thread_Body_Leave;
82   --  Leave thread body (normally), see above for details
83
84   procedure Thread_Body_Exceptional_Exit
85     (EO : Ada.Exceptions.Exception_Occurrence);
86   --  Leave thread body (abnormally on exception), see above for details
87
88private
89
90   type ATSD is new System.Soft_Links.TSD;
91
92end System.Threads;
93