1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . T H R E A D S --
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package provides facilities to register a thread to the runtime,
33 -- and allocate its task specific datas.
35 -- This package is currently implemented for:
37 -- VxWorks AE653 rts-cert
38 -- VxWorks AE653 rts-full (not rts-kernel)
41 with Ada
.Unchecked_Conversion
;
45 with System
.Secondary_Stack
;
46 with System
.Soft_Links
;
48 package System
.Threads
is
50 package SST
renames System
.Secondary_Stack
;
52 type ATSD
is limited private;
53 -- Type of the Ada thread specific data. It contains datas needed
54 -- by the GNAT runtime.
56 type ATSD_Access
is access ATSD
;
57 function From_Address
is
58 new Ada
.Unchecked_Conversion
(Address
, ATSD_Access
);
60 subtype STATUS
is Interfaces
.C
.int
;
61 -- Equivalent of the C type STATUS
63 type t_id
is new Interfaces
.C
.long
;
64 subtype Thread_Id
is t_id
;
66 function Register
(T
: Thread_Id
) return STATUS
;
67 -- Create the task specific data necessary for Ada language support
69 --------------------------
70 -- Thread Body Handling --
71 --------------------------
73 -- The subprograms in this section are called from the process body
74 -- wrapper in the APEX process registration package.
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
81 procedure Thread_Body_Leave
;
82 -- Leave thread body (normally), see above for details
84 procedure Thread_Body_Exceptional_Exit
85 (EO
: Ada
.Exceptions
.Exception_Occurrence
);
86 -- Leave thread body (abnormally on exception), see above for details
90 type ATSD
is new System
.Soft_Links
.TSD
;