File : s-thread.ads
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-2010, 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 -- 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
40 with Ada.Exceptions;
41 with Ada.Unchecked_Conversion;
42
43 with Interfaces.C;
44
45 with System.Soft_Links;
46
47 package System.Threads is
48
49 type ATSD is limited private;
50 -- Type of the Ada thread specific data. It contains datas needed
51 -- by the GNAT runtime.
52
53 type ATSD_Access is access ATSD;
54 function From_Address is
55 new Ada.Unchecked_Conversion (Address, ATSD_Access);
56
57 subtype STATUS is Interfaces.C.int;
58 -- Equivalent of the C type STATUS
59
60 type t_id is new Interfaces.C.long;
61 subtype Thread_Id is t_id;
62
63 function Register (T : Thread_Id) return STATUS;
64 -- Create the task specific data necessary for Ada language support
65
66 --------------------------
67 -- Thread Body Handling --
68 --------------------------
69
70 -- The subprograms in this section are called from the process body
71 -- wrapper in the APEX process registration package.
72
73 procedure Thread_Body_Enter
74 (Sec_Stack_Address : System.Address;
75 Sec_Stack_Size : Natural;
76 Process_ATSD_Address : System.Address);
77 -- Enter thread body, see above for details
78
79 procedure Thread_Body_Leave;
80 -- Leave thread body (normally), see above for details
81
82 procedure Thread_Body_Exceptional_Exit
83 (EO : Ada.Exceptions.Exception_Occurrence);
84 -- Leave thread body (abnormally on exception), see above for details
85
86 private
87
88 type ATSD is new System.Soft_Links.TSD;
89
90 end System.Threads;