annotate gcc/ada/libgnarl/s-tarest.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . T A S K I N G . R E S T R I C T E D . S T A G E S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- B o d y --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1999-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNARL is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNARL was developed by the GNARL team at Florida State University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 pragma Style_Checks (All_Checks);
kono
parents:
diff changeset
33 -- Turn off subprogram alpha order check, since we group soft link
kono
parents:
diff changeset
34 -- bodies and also separate off subprograms for restricted GNARLI.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- This is a simplified version of the System.Tasking.Stages package,
kono
parents:
diff changeset
37 -- intended to be used in a restricted run time.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 -- This package represents the high level tasking interface used by the
kono
parents:
diff changeset
40 -- compiler to expand Ada 95 tasking constructs into simpler run time calls.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 pragma Polling (Off);
kono
parents:
diff changeset
43 -- Turn off polling, we do not want ATC polling to take place during
kono
parents:
diff changeset
44 -- tasking operations. It causes infinite loops and other problems.
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 with Ada.Exceptions;
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 with System.Task_Primitives.Operations;
kono
parents:
diff changeset
49 with System.Soft_Links.Tasking;
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 with System.Soft_Links;
kono
parents:
diff changeset
52 -- Used for the non-tasking routines (*_NT) that refer to global data. They
kono
parents:
diff changeset
53 -- are needed here before the tasking run time has been elaborated. used for
kono
parents:
diff changeset
54 -- Create_TSD This package also provides initialization routines for task
kono
parents:
diff changeset
55 -- specific data. The GNARL must call these to be sure that all non-tasking
kono
parents:
diff changeset
56 -- Ada constructs will work.
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 package body System.Tasking.Restricted.Stages is
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 package STPO renames System.Task_Primitives.Operations;
kono
parents:
diff changeset
61 package SSL renames System.Soft_Links;
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 use Ada.Exceptions;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 use Parameters;
kono
parents:
diff changeset
66 use Task_Primitives.Operations;
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 Tasks_Activation_Chain : Task_Id;
kono
parents:
diff changeset
69 -- Chain of all the tasks to activate
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 Global_Task_Lock : aliased System.Task_Primitives.RTS_Lock;
kono
parents:
diff changeset
72 -- This is a global lock; it is used to execute in mutual exclusion
kono
parents:
diff changeset
73 -- from all other tasks. It is only used by Task_Lock and Task_Unlock.
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 -----------------------------------------------------------------
kono
parents:
diff changeset
76 -- Tasking versions of services needed by non-tasking programs --
kono
parents:
diff changeset
77 -----------------------------------------------------------------
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 function Get_Current_Excep return SSL.EOA;
kono
parents:
diff changeset
80 -- Task-safe version of SSL.Get_Current_Excep
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 procedure Task_Lock;
kono
parents:
diff changeset
83 -- Locks out other tasks. Preceding a section of code by Task_Lock and
kono
parents:
diff changeset
84 -- following it by Task_Unlock creates a critical region. This is used
kono
parents:
diff changeset
85 -- for ensuring that a region of non-tasking code (such as code used to
kono
parents:
diff changeset
86 -- allocate memory) is tasking safe. Note that it is valid for calls to
kono
parents:
diff changeset
87 -- Task_Lock/Task_Unlock to be nested, and this must work properly, i.e.
kono
parents:
diff changeset
88 -- only the corresponding outer level Task_Unlock will actually unlock.
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 procedure Task_Unlock;
kono
parents:
diff changeset
91 -- Releases lock previously set by call to Task_Lock. In the nested case,
kono
parents:
diff changeset
92 -- all nested locks must be released before other tasks competing for the
kono
parents:
diff changeset
93 -- tasking lock are released.
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 -----------------------
kono
parents:
diff changeset
96 -- Local Subprograms --
kono
parents:
diff changeset
97 -----------------------
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 procedure Task_Wrapper (Self_ID : Task_Id);
kono
parents:
diff changeset
100 -- This is the procedure that is called by the GNULL from the
kono
parents:
diff changeset
101 -- new context when a task is created. It waits for activation
kono
parents:
diff changeset
102 -- and then calls the task body procedure. When the task body
kono
parents:
diff changeset
103 -- procedure completes, it terminates the task.
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 procedure Terminate_Task (Self_ID : Task_Id);
kono
parents:
diff changeset
106 -- Terminate the calling task.
kono
parents:
diff changeset
107 -- This should only be called by the Task_Wrapper procedure.
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 procedure Create_Restricted_Task
kono
parents:
diff changeset
110 (Priority : Integer;
kono
parents:
diff changeset
111 Stack_Address : System.Address;
kono
parents:
diff changeset
112 Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
113 Sec_Stack_Address : System.Secondary_Stack.SS_Stack_Ptr;
kono
parents:
diff changeset
114 Sec_Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
115 Task_Info : System.Task_Info.Task_Info_Type;
kono
parents:
diff changeset
116 CPU : Integer;
kono
parents:
diff changeset
117 State : Task_Procedure_Access;
kono
parents:
diff changeset
118 Discriminants : System.Address;
kono
parents:
diff changeset
119 Elaborated : Access_Boolean;
kono
parents:
diff changeset
120 Task_Image : String;
kono
parents:
diff changeset
121 Created_Task : Task_Id);
kono
parents:
diff changeset
122 -- Code shared between Create_Restricted_Task (the concurrent version) and
kono
parents:
diff changeset
123 -- Create_Restricted_Task_Sequential. See comment of the former in the
kono
parents:
diff changeset
124 -- specification of this package.
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 procedure Activate_Tasks (Chain : Task_Id);
kono
parents:
diff changeset
127 -- Activate the list of tasks started by Chain
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 procedure Init_RTS;
kono
parents:
diff changeset
130 -- This procedure performs the initialization of the GNARL.
kono
parents:
diff changeset
131 -- It consists of initializing the environment task, global locks, and
kono
parents:
diff changeset
132 -- installing tasking versions of certain operations used by the compiler.
kono
parents:
diff changeset
133 -- Init_RTS is called during elaboration.
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -----------------------
kono
parents:
diff changeset
136 -- Get_Current_Excep --
kono
parents:
diff changeset
137 -----------------------
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 function Get_Current_Excep return SSL.EOA is
kono
parents:
diff changeset
140 begin
kono
parents:
diff changeset
141 return STPO.Self.Common.Compiler_Data.Current_Excep'Access;
kono
parents:
diff changeset
142 end Get_Current_Excep;
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 ---------------
kono
parents:
diff changeset
145 -- Task_Lock --
kono
parents:
diff changeset
146 ---------------
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 procedure Task_Lock is
kono
parents:
diff changeset
149 Self_ID : constant Task_Id := STPO.Self;
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 begin
kono
parents:
diff changeset
152 Self_ID.Common.Global_Task_Lock_Nesting :=
kono
parents:
diff changeset
153 Self_ID.Common.Global_Task_Lock_Nesting + 1;
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 if Self_ID.Common.Global_Task_Lock_Nesting = 1 then
kono
parents:
diff changeset
156 STPO.Write_Lock (Global_Task_Lock'Access, Global_Lock => True);
kono
parents:
diff changeset
157 end if;
kono
parents:
diff changeset
158 end Task_Lock;
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 -----------------
kono
parents:
diff changeset
161 -- Task_Unlock --
kono
parents:
diff changeset
162 -----------------
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 procedure Task_Unlock is
kono
parents:
diff changeset
165 Self_ID : constant Task_Id := STPO.Self;
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 begin
kono
parents:
diff changeset
168 pragma Assert (Self_ID.Common.Global_Task_Lock_Nesting > 0);
kono
parents:
diff changeset
169 Self_ID.Common.Global_Task_Lock_Nesting :=
kono
parents:
diff changeset
170 Self_ID.Common.Global_Task_Lock_Nesting - 1;
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 if Self_ID.Common.Global_Task_Lock_Nesting = 0 then
kono
parents:
diff changeset
173 STPO.Unlock (Global_Task_Lock'Access, Global_Lock => True);
kono
parents:
diff changeset
174 end if;
kono
parents:
diff changeset
175 end Task_Unlock;
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 ------------------
kono
parents:
diff changeset
178 -- Task_Wrapper --
kono
parents:
diff changeset
179 ------------------
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 -- The task wrapper is a procedure that is called first for each task
kono
parents:
diff changeset
182 -- task body, and which in turn calls the compiler-generated task body
kono
parents:
diff changeset
183 -- procedure. The wrapper's main job is to do initialization for the task.
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 -- The variable ID in the task wrapper is used to implement the Self
kono
parents:
diff changeset
186 -- function on targets where there is a fast way to find the stack base
kono
parents:
diff changeset
187 -- of the current thread, since it should be at a fixed offset from the
kono
parents:
diff changeset
188 -- stack base.
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 procedure Task_Wrapper (Self_ID : Task_Id) is
kono
parents:
diff changeset
191 ID : Task_Id := Self_ID;
kono
parents:
diff changeset
192 pragma Volatile (ID);
kono
parents:
diff changeset
193 pragma Warnings (Off, ID);
kono
parents:
diff changeset
194 -- Variable used on some targets to implement a fast self. We turn off
kono
parents:
diff changeset
195 -- warnings because a stand alone volatile constant has to be imported,
kono
parents:
diff changeset
196 -- so we don't want warnings about ID not being referenced, and volatile
kono
parents:
diff changeset
197 -- having no effect.
kono
parents:
diff changeset
198 --
kono
parents:
diff changeset
199 -- DO NOT delete ID. As noted, it is needed on some targets.
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201 Cause : Cause_Of_Termination := Normal;
kono
parents:
diff changeset
202 -- Indicates the reason why this task terminates. Normal corresponds to
kono
parents:
diff changeset
203 -- a task terminating due to completing the last statement of its body.
kono
parents:
diff changeset
204 -- If the task terminates because of an exception raised by the
kono
parents:
diff changeset
205 -- execution of its task body, then Cause is set to Unhandled_Exception.
kono
parents:
diff changeset
206 -- Aborts are not allowed in the restricted profile to which this file
kono
parents:
diff changeset
207 -- belongs.
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 EO : Exception_Occurrence;
kono
parents:
diff changeset
210 -- If the task terminates because of an exception raised by the
kono
parents:
diff changeset
211 -- execution of its task body, then EO will contain the associated
kono
parents:
diff changeset
212 -- exception occurrence. Otherwise, it will contain Null_Occurrence.
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 begin
kono
parents:
diff changeset
215 -- Initialize low-level TCB components, that cannot be initialized by
kono
parents:
diff changeset
216 -- the creator.
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 Enter_Task (Self_ID);
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 -- Call the task body procedure
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 begin
kono
parents:
diff changeset
223 -- We are separating the following portion of the code in order to
kono
parents:
diff changeset
224 -- place the exception handlers in a different block. In this way we
kono
parents:
diff changeset
225 -- do not call Set_Jmpbuf_Address (which needs Self) before we set
kono
parents:
diff changeset
226 -- Self in Enter_Task.
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 -- Note that in the case of Ravenscar HI-E where there are no
kono
parents:
diff changeset
229 -- exception handlers, the exception handler is suppressed.
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 -- Call the task body procedure
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 Self_ID.Common.Task_Entry_Point (Self_ID.Common.Task_Arg);
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 -- Normal task termination
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 Cause := Normal;
kono
parents:
diff changeset
238 Save_Occurrence (EO, Ada.Exceptions.Null_Occurrence);
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 exception
kono
parents:
diff changeset
241 when E : others =>
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 -- Task terminating because of an unhandled exception
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 Cause := Unhandled_Exception;
kono
parents:
diff changeset
246 Save_Occurrence (EO, E);
kono
parents:
diff changeset
247 end;
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 -- Look for a fall-back handler
kono
parents:
diff changeset
250
kono
parents:
diff changeset
251 -- This package is part of the restricted run time which supports
kono
parents:
diff changeset
252 -- neither task hierarchies (No_Task_Hierarchy) nor specific task
kono
parents:
diff changeset
253 -- termination handlers (No_Specific_Termination_Handlers).
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 -- As specified in ARM C.7.3 par. 9/2, "the fall-back handler applies
kono
parents:
diff changeset
256 -- only to the dependent tasks of the task". Hence, if the terminating
kono
parents:
diff changeset
257 -- tasks (Self_ID) had a fall-back handler, it would not apply to
kono
parents:
diff changeset
258 -- itself. This code is always executed by a task whose master is the
kono
parents:
diff changeset
259 -- environment task (the task termination code for the environment task
kono
parents:
diff changeset
260 -- is executed by SSL.Task_Termination_Handler), so the fall-back
kono
parents:
diff changeset
261 -- handler to execute for this task can only be defined by its parent
kono
parents:
diff changeset
262 -- (there is no grandparent).
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 declare
kono
parents:
diff changeset
265 TH : Termination_Handler := null;
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 begin
kono
parents:
diff changeset
268 if Single_Lock then
kono
parents:
diff changeset
269 Lock_RTS;
kono
parents:
diff changeset
270 end if;
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 Write_Lock (Self_ID.Common.Parent);
kono
parents:
diff changeset
273
kono
parents:
diff changeset
274 TH := Self_ID.Common.Parent.Common.Fall_Back_Handler;
kono
parents:
diff changeset
275
kono
parents:
diff changeset
276 Unlock (Self_ID.Common.Parent);
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 if Single_Lock then
kono
parents:
diff changeset
279 Unlock_RTS;
kono
parents:
diff changeset
280 end if;
kono
parents:
diff changeset
281
kono
parents:
diff changeset
282 -- Execute the task termination handler if we found it
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 if TH /= null then
kono
parents:
diff changeset
285 TH.all (Cause, Self_ID, EO);
kono
parents:
diff changeset
286 end if;
kono
parents:
diff changeset
287 end;
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 Terminate_Task (Self_ID);
kono
parents:
diff changeset
290 end Task_Wrapper;
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292 -----------------------
kono
parents:
diff changeset
293 -- Restricted GNARLI --
kono
parents:
diff changeset
294 -----------------------
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 -----------------------------------
kono
parents:
diff changeset
297 -- Activate_All_Tasks_Sequential --
kono
parents:
diff changeset
298 -----------------------------------
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 procedure Activate_All_Tasks_Sequential is
kono
parents:
diff changeset
301 begin
kono
parents:
diff changeset
302 pragma Assert (Partition_Elaboration_Policy = 'S');
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 Activate_Tasks (Tasks_Activation_Chain);
kono
parents:
diff changeset
305 Tasks_Activation_Chain := Null_Task;
kono
parents:
diff changeset
306 end Activate_All_Tasks_Sequential;
kono
parents:
diff changeset
307
kono
parents:
diff changeset
308 -------------------------------
kono
parents:
diff changeset
309 -- Activate_Restricted_Tasks --
kono
parents:
diff changeset
310 -------------------------------
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 procedure Activate_Restricted_Tasks
kono
parents:
diff changeset
313 (Chain_Access : Activation_Chain_Access) is
kono
parents:
diff changeset
314 begin
kono
parents:
diff changeset
315 if Partition_Elaboration_Policy = 'S' then
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 -- In sequential elaboration policy, the chain must be empty. This
kono
parents:
diff changeset
318 -- procedure can be called if the unit has been compiled without
kono
parents:
diff changeset
319 -- partition elaboration policy, but the partition has a sequential
kono
parents:
diff changeset
320 -- elaboration policy.
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 pragma Assert (Chain_Access.T_ID = Null_Task);
kono
parents:
diff changeset
323 null;
kono
parents:
diff changeset
324 else
kono
parents:
diff changeset
325 Activate_Tasks (Chain_Access.T_ID);
kono
parents:
diff changeset
326 Chain_Access.T_ID := Null_Task;
kono
parents:
diff changeset
327 end if;
kono
parents:
diff changeset
328 end Activate_Restricted_Tasks;
kono
parents:
diff changeset
329
kono
parents:
diff changeset
330 --------------------
kono
parents:
diff changeset
331 -- Activate_Tasks --
kono
parents:
diff changeset
332 --------------------
kono
parents:
diff changeset
333
kono
parents:
diff changeset
334 -- Note that locks of activator and activated task are both locked here.
kono
parents:
diff changeset
335 -- This is necessary because C.State and Self.Wait_Count have to be
kono
parents:
diff changeset
336 -- synchronized. This is safe from deadlock because the activator is always
kono
parents:
diff changeset
337 -- created before the activated task. That satisfies our
kono
parents:
diff changeset
338 -- in-order-of-creation ATCB locking policy.
kono
parents:
diff changeset
339
kono
parents:
diff changeset
340 procedure Activate_Tasks (Chain : Task_Id) is
kono
parents:
diff changeset
341 Self_ID : constant Task_Id := STPO.Self;
kono
parents:
diff changeset
342 C : Task_Id;
kono
parents:
diff changeset
343 Activate_Prio : System.Any_Priority;
kono
parents:
diff changeset
344 Success : Boolean;
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 begin
kono
parents:
diff changeset
347 pragma Assert (Self_ID = Environment_Task);
kono
parents:
diff changeset
348 pragma Assert (Self_ID.Common.Wait_Count = 0);
kono
parents:
diff changeset
349
kono
parents:
diff changeset
350 if Single_Lock then
kono
parents:
diff changeset
351 Lock_RTS;
kono
parents:
diff changeset
352 end if;
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 -- Lock self, to prevent activated tasks from racing ahead before we
kono
parents:
diff changeset
355 -- finish activating the chain.
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357 Write_Lock (Self_ID);
kono
parents:
diff changeset
358
kono
parents:
diff changeset
359 -- Activate all the tasks in the chain. Creation of the thread of
kono
parents:
diff changeset
360 -- control was deferred until activation. So create it now.
kono
parents:
diff changeset
361
kono
parents:
diff changeset
362 C := Chain;
kono
parents:
diff changeset
363 while C /= null loop
kono
parents:
diff changeset
364 if C.Common.State /= Terminated then
kono
parents:
diff changeset
365 pragma Assert (C.Common.State = Unactivated);
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 Write_Lock (C);
kono
parents:
diff changeset
368
kono
parents:
diff changeset
369 Activate_Prio :=
kono
parents:
diff changeset
370 (if C.Common.Base_Priority < Get_Priority (Self_ID)
kono
parents:
diff changeset
371 then Get_Priority (Self_ID)
kono
parents:
diff changeset
372 else C.Common.Base_Priority);
kono
parents:
diff changeset
373
kono
parents:
diff changeset
374 STPO.Create_Task
kono
parents:
diff changeset
375 (C, Task_Wrapper'Address,
kono
parents:
diff changeset
376 Parameters.Size_Type
kono
parents:
diff changeset
377 (C.Common.Compiler_Data.Pri_Stack_Info.Size),
kono
parents:
diff changeset
378 Activate_Prio, Success);
kono
parents:
diff changeset
379
kono
parents:
diff changeset
380 Self_ID.Common.Wait_Count := Self_ID.Common.Wait_Count + 1;
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 if Success then
kono
parents:
diff changeset
383 C.Common.State := Runnable;
kono
parents:
diff changeset
384 else
kono
parents:
diff changeset
385 raise Program_Error;
kono
parents:
diff changeset
386 end if;
kono
parents:
diff changeset
387
kono
parents:
diff changeset
388 Unlock (C);
kono
parents:
diff changeset
389 end if;
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391 C := C.Common.Activation_Link;
kono
parents:
diff changeset
392 end loop;
kono
parents:
diff changeset
393
kono
parents:
diff changeset
394 Self_ID.Common.State := Activator_Sleep;
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 -- Wait for the activated tasks to complete activation. It is unsafe to
kono
parents:
diff changeset
397 -- abort any of these tasks until the count goes to zero.
kono
parents:
diff changeset
398
kono
parents:
diff changeset
399 loop
kono
parents:
diff changeset
400 exit when Self_ID.Common.Wait_Count = 0;
kono
parents:
diff changeset
401 Sleep (Self_ID, Activator_Sleep);
kono
parents:
diff changeset
402 end loop;
kono
parents:
diff changeset
403
kono
parents:
diff changeset
404 Self_ID.Common.State := Runnable;
kono
parents:
diff changeset
405 Unlock (Self_ID);
kono
parents:
diff changeset
406
kono
parents:
diff changeset
407 if Single_Lock then
kono
parents:
diff changeset
408 Unlock_RTS;
kono
parents:
diff changeset
409 end if;
kono
parents:
diff changeset
410 end Activate_Tasks;
kono
parents:
diff changeset
411
kono
parents:
diff changeset
412 ------------------------------------
kono
parents:
diff changeset
413 -- Complete_Restricted_Activation --
kono
parents:
diff changeset
414 ------------------------------------
kono
parents:
diff changeset
415
kono
parents:
diff changeset
416 -- As in several other places, the locks of the activator and activated
kono
parents:
diff changeset
417 -- task are both locked here. This follows our deadlock prevention lock
kono
parents:
diff changeset
418 -- ordering policy, since the activated task must be created after the
kono
parents:
diff changeset
419 -- activator.
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 procedure Complete_Restricted_Activation is
kono
parents:
diff changeset
422 Self_ID : constant Task_Id := STPO.Self;
kono
parents:
diff changeset
423 Activator : constant Task_Id := Self_ID.Common.Activator;
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425 begin
kono
parents:
diff changeset
426 if Single_Lock then
kono
parents:
diff changeset
427 Lock_RTS;
kono
parents:
diff changeset
428 end if;
kono
parents:
diff changeset
429
kono
parents:
diff changeset
430 Write_Lock (Activator);
kono
parents:
diff changeset
431 Write_Lock (Self_ID);
kono
parents:
diff changeset
432
kono
parents:
diff changeset
433 -- Remove dangling reference to Activator, since a task may outlive its
kono
parents:
diff changeset
434 -- activator.
kono
parents:
diff changeset
435
kono
parents:
diff changeset
436 Self_ID.Common.Activator := null;
kono
parents:
diff changeset
437
kono
parents:
diff changeset
438 -- Wake up the activator, if it is waiting for a chain of tasks to
kono
parents:
diff changeset
439 -- activate, and we are the last in the chain to complete activation
kono
parents:
diff changeset
440
kono
parents:
diff changeset
441 if Activator.Common.State = Activator_Sleep then
kono
parents:
diff changeset
442 Activator.Common.Wait_Count := Activator.Common.Wait_Count - 1;
kono
parents:
diff changeset
443
kono
parents:
diff changeset
444 if Activator.Common.Wait_Count = 0 then
kono
parents:
diff changeset
445 Wakeup (Activator, Activator_Sleep);
kono
parents:
diff changeset
446 end if;
kono
parents:
diff changeset
447 end if;
kono
parents:
diff changeset
448
kono
parents:
diff changeset
449 Unlock (Self_ID);
kono
parents:
diff changeset
450 Unlock (Activator);
kono
parents:
diff changeset
451
kono
parents:
diff changeset
452 if Single_Lock then
kono
parents:
diff changeset
453 Unlock_RTS;
kono
parents:
diff changeset
454 end if;
kono
parents:
diff changeset
455
kono
parents:
diff changeset
456 -- After the activation, active priority should be the same as base
kono
parents:
diff changeset
457 -- priority. We must unlock the Activator first, though, since it should
kono
parents:
diff changeset
458 -- not wait if we have lower priority.
kono
parents:
diff changeset
459
kono
parents:
diff changeset
460 if Get_Priority (Self_ID) /= Self_ID.Common.Base_Priority then
kono
parents:
diff changeset
461 Set_Priority (Self_ID, Self_ID.Common.Base_Priority);
kono
parents:
diff changeset
462 end if;
kono
parents:
diff changeset
463 end Complete_Restricted_Activation;
kono
parents:
diff changeset
464
kono
parents:
diff changeset
465 ------------------------------
kono
parents:
diff changeset
466 -- Complete_Restricted_Task --
kono
parents:
diff changeset
467 ------------------------------
kono
parents:
diff changeset
468
kono
parents:
diff changeset
469 procedure Complete_Restricted_Task is
kono
parents:
diff changeset
470 begin
kono
parents:
diff changeset
471 STPO.Self.Common.State := Terminated;
kono
parents:
diff changeset
472 end Complete_Restricted_Task;
kono
parents:
diff changeset
473
kono
parents:
diff changeset
474 ----------------------------
kono
parents:
diff changeset
475 -- Create_Restricted_Task --
kono
parents:
diff changeset
476 ----------------------------
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 procedure Create_Restricted_Task
kono
parents:
diff changeset
479 (Priority : Integer;
kono
parents:
diff changeset
480 Stack_Address : System.Address;
kono
parents:
diff changeset
481 Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
482 Sec_Stack_Address : System.Secondary_Stack.SS_Stack_Ptr;
kono
parents:
diff changeset
483 Sec_Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
484 Task_Info : System.Task_Info.Task_Info_Type;
kono
parents:
diff changeset
485 CPU : Integer;
kono
parents:
diff changeset
486 State : Task_Procedure_Access;
kono
parents:
diff changeset
487 Discriminants : System.Address;
kono
parents:
diff changeset
488 Elaborated : Access_Boolean;
kono
parents:
diff changeset
489 Task_Image : String;
kono
parents:
diff changeset
490 Created_Task : Task_Id)
kono
parents:
diff changeset
491 is
kono
parents:
diff changeset
492 Self_ID : constant Task_Id := STPO.Self;
kono
parents:
diff changeset
493 Base_Priority : System.Any_Priority;
kono
parents:
diff changeset
494 Base_CPU : System.Multiprocessors.CPU_Range;
kono
parents:
diff changeset
495 Success : Boolean;
kono
parents:
diff changeset
496 Len : Integer;
kono
parents:
diff changeset
497
kono
parents:
diff changeset
498 begin
kono
parents:
diff changeset
499 -- Stack is not preallocated on this target, so that Stack_Address must
kono
parents:
diff changeset
500 -- be null.
kono
parents:
diff changeset
501
kono
parents:
diff changeset
502 pragma Assert (Stack_Address = Null_Address);
kono
parents:
diff changeset
503
kono
parents:
diff changeset
504 Base_Priority :=
kono
parents:
diff changeset
505 (if Priority = Unspecified_Priority
kono
parents:
diff changeset
506 then Self_ID.Common.Base_Priority
kono
parents:
diff changeset
507 else System.Any_Priority (Priority));
kono
parents:
diff changeset
508
kono
parents:
diff changeset
509 -- Legal values of CPU are the special Unspecified_CPU value which is
kono
parents:
diff changeset
510 -- inserted by the compiler for tasks without CPU aspect, and those in
kono
parents:
diff changeset
511 -- the range of CPU_Range but no greater than Number_Of_CPUs. Otherwise
kono
parents:
diff changeset
512 -- the task is defined to have failed, and it becomes a completed task
kono
parents:
diff changeset
513 -- (RM D.16(14/3)).
kono
parents:
diff changeset
514
kono
parents:
diff changeset
515 if CPU /= Unspecified_CPU
kono
parents:
diff changeset
516 and then (CPU < Integer (System.Multiprocessors.CPU_Range'First)
kono
parents:
diff changeset
517 or else CPU > Integer (System.Multiprocessors.Number_Of_CPUs))
kono
parents:
diff changeset
518 then
kono
parents:
diff changeset
519 raise Tasking_Error with "CPU not in range";
kono
parents:
diff changeset
520
kono
parents:
diff changeset
521 -- Normal CPU affinity
kono
parents:
diff changeset
522 else
kono
parents:
diff changeset
523 -- When the application code says nothing about the task affinity
kono
parents:
diff changeset
524 -- (task without CPU aspect) then the compiler inserts the
kono
parents:
diff changeset
525 -- Unspecified_CPU value which indicates to the run-time library that
kono
parents:
diff changeset
526 -- the task will activate and execute on the same processor as its
kono
parents:
diff changeset
527 -- activating task if the activating task is assigned a processor
kono
parents:
diff changeset
528 -- (RM D.16(14/3)).
kono
parents:
diff changeset
529
kono
parents:
diff changeset
530 Base_CPU :=
kono
parents:
diff changeset
531 (if CPU = Unspecified_CPU
kono
parents:
diff changeset
532 then Self_ID.Common.Base_CPU
kono
parents:
diff changeset
533 else System.Multiprocessors.CPU_Range (CPU));
kono
parents:
diff changeset
534 end if;
kono
parents:
diff changeset
535
kono
parents:
diff changeset
536 if Single_Lock then
kono
parents:
diff changeset
537 Lock_RTS;
kono
parents:
diff changeset
538 end if;
kono
parents:
diff changeset
539
kono
parents:
diff changeset
540 Write_Lock (Self_ID);
kono
parents:
diff changeset
541
kono
parents:
diff changeset
542 -- With no task hierarchy, the parent of all non-Environment tasks that
kono
parents:
diff changeset
543 -- are created must be the Environment task. Dispatching domains are
kono
parents:
diff changeset
544 -- not allowed in Ravenscar, so the dispatching domain parameter will
kono
parents:
diff changeset
545 -- always be null.
kono
parents:
diff changeset
546
kono
parents:
diff changeset
547 Initialize_ATCB
kono
parents:
diff changeset
548 (Self_ID, State, Discriminants, Self_ID, Elaborated, Base_Priority,
kono
parents:
diff changeset
549 Base_CPU, null, Task_Info, Stack_Size, Created_Task, Success);
kono
parents:
diff changeset
550
kono
parents:
diff changeset
551 -- If we do our job right then there should never be any failures, which
kono
parents:
diff changeset
552 -- was probably said about the Titanic; so just to be safe, let's retain
kono
parents:
diff changeset
553 -- this code for now
kono
parents:
diff changeset
554
kono
parents:
diff changeset
555 if not Success then
kono
parents:
diff changeset
556 Unlock (Self_ID);
kono
parents:
diff changeset
557
kono
parents:
diff changeset
558 if Single_Lock then
kono
parents:
diff changeset
559 Unlock_RTS;
kono
parents:
diff changeset
560 end if;
kono
parents:
diff changeset
561
kono
parents:
diff changeset
562 raise Program_Error;
kono
parents:
diff changeset
563 end if;
kono
parents:
diff changeset
564
kono
parents:
diff changeset
565 Created_Task.Entry_Calls (1).Self := Created_Task;
kono
parents:
diff changeset
566
kono
parents:
diff changeset
567 Len :=
kono
parents:
diff changeset
568 Integer'Min (Created_Task.Common.Task_Image'Length, Task_Image'Length);
kono
parents:
diff changeset
569 Created_Task.Common.Task_Image_Len := Len;
kono
parents:
diff changeset
570 Created_Task.Common.Task_Image (1 .. Len) :=
kono
parents:
diff changeset
571 Task_Image (Task_Image'First .. Task_Image'First + Len - 1);
kono
parents:
diff changeset
572
kono
parents:
diff changeset
573 Unlock (Self_ID);
kono
parents:
diff changeset
574
kono
parents:
diff changeset
575 if Single_Lock then
kono
parents:
diff changeset
576 Unlock_RTS;
kono
parents:
diff changeset
577 end if;
kono
parents:
diff changeset
578
kono
parents:
diff changeset
579 -- Create TSD as early as possible in the creation of a task, since
kono
parents:
diff changeset
580 -- it may be used by the operation of Ada code within the task. If the
kono
parents:
diff changeset
581 -- compiler has not allocated a secondary stack, a stack will be
kono
parents:
diff changeset
582 -- allocated fromt the binder generated pool.
kono
parents:
diff changeset
583
kono
parents:
diff changeset
584 SSL.Create_TSD
kono
parents:
diff changeset
585 (Created_Task.Common.Compiler_Data,
kono
parents:
diff changeset
586 Sec_Stack_Address,
kono
parents:
diff changeset
587 Sec_Stack_Size);
kono
parents:
diff changeset
588 end Create_Restricted_Task;
kono
parents:
diff changeset
589
kono
parents:
diff changeset
590 procedure Create_Restricted_Task
kono
parents:
diff changeset
591 (Priority : Integer;
kono
parents:
diff changeset
592 Stack_Address : System.Address;
kono
parents:
diff changeset
593 Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
594 Sec_Stack_Address : System.Secondary_Stack.SS_Stack_Ptr;
kono
parents:
diff changeset
595 Sec_Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
596 Task_Info : System.Task_Info.Task_Info_Type;
kono
parents:
diff changeset
597 CPU : Integer;
kono
parents:
diff changeset
598 State : Task_Procedure_Access;
kono
parents:
diff changeset
599 Discriminants : System.Address;
kono
parents:
diff changeset
600 Elaborated : Access_Boolean;
kono
parents:
diff changeset
601 Chain : in out Activation_Chain;
kono
parents:
diff changeset
602 Task_Image : String;
kono
parents:
diff changeset
603 Created_Task : Task_Id)
kono
parents:
diff changeset
604 is
kono
parents:
diff changeset
605 begin
kono
parents:
diff changeset
606 if Partition_Elaboration_Policy = 'S' then
kono
parents:
diff changeset
607
kono
parents:
diff changeset
608 -- A unit may have been compiled without partition elaboration
kono
parents:
diff changeset
609 -- policy, and in this case the compiler will emit calls for the
kono
parents:
diff changeset
610 -- default policy (concurrent). But if the partition policy is
kono
parents:
diff changeset
611 -- sequential, activation must be deferred.
kono
parents:
diff changeset
612
kono
parents:
diff changeset
613 Create_Restricted_Task_Sequential
kono
parents:
diff changeset
614 (Priority, Stack_Address, Stack_Size, Sec_Stack_Address,
kono
parents:
diff changeset
615 Sec_Stack_Size, Task_Info, CPU, State, Discriminants, Elaborated,
kono
parents:
diff changeset
616 Task_Image, Created_Task);
kono
parents:
diff changeset
617
kono
parents:
diff changeset
618 else
kono
parents:
diff changeset
619 Create_Restricted_Task
kono
parents:
diff changeset
620 (Priority, Stack_Address, Stack_Size, Sec_Stack_Address,
kono
parents:
diff changeset
621 Sec_Stack_Size, Task_Info, CPU, State, Discriminants, Elaborated,
kono
parents:
diff changeset
622 Task_Image, Created_Task);
kono
parents:
diff changeset
623
kono
parents:
diff changeset
624 -- Append this task to the activation chain
kono
parents:
diff changeset
625
kono
parents:
diff changeset
626 Created_Task.Common.Activation_Link := Chain.T_ID;
kono
parents:
diff changeset
627 Chain.T_ID := Created_Task;
kono
parents:
diff changeset
628 end if;
kono
parents:
diff changeset
629 end Create_Restricted_Task;
kono
parents:
diff changeset
630
kono
parents:
diff changeset
631 ---------------------------------------
kono
parents:
diff changeset
632 -- Create_Restricted_Task_Sequential --
kono
parents:
diff changeset
633 ---------------------------------------
kono
parents:
diff changeset
634
kono
parents:
diff changeset
635 procedure Create_Restricted_Task_Sequential
kono
parents:
diff changeset
636 (Priority : Integer;
kono
parents:
diff changeset
637 Stack_Address : System.Address;
kono
parents:
diff changeset
638 Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
639 Sec_Stack_Address : System.Secondary_Stack.SS_Stack_Ptr;
kono
parents:
diff changeset
640 Sec_Stack_Size : System.Parameters.Size_Type;
kono
parents:
diff changeset
641 Task_Info : System.Task_Info.Task_Info_Type;
kono
parents:
diff changeset
642 CPU : Integer;
kono
parents:
diff changeset
643 State : Task_Procedure_Access;
kono
parents:
diff changeset
644 Discriminants : System.Address;
kono
parents:
diff changeset
645 Elaborated : Access_Boolean;
kono
parents:
diff changeset
646 Task_Image : String;
kono
parents:
diff changeset
647 Created_Task : Task_Id)
kono
parents:
diff changeset
648 is
kono
parents:
diff changeset
649 begin
kono
parents:
diff changeset
650 Create_Restricted_Task
kono
parents:
diff changeset
651 (Priority, Stack_Address, Stack_Size, Sec_Stack_Address,
kono
parents:
diff changeset
652 Sec_Stack_Size, Task_Info, CPU, State, Discriminants, Elaborated,
kono
parents:
diff changeset
653 Task_Image, Created_Task);
kono
parents:
diff changeset
654
kono
parents:
diff changeset
655 -- Append this task to the activation chain
kono
parents:
diff changeset
656
kono
parents:
diff changeset
657 Created_Task.Common.Activation_Link := Tasks_Activation_Chain;
kono
parents:
diff changeset
658 Tasks_Activation_Chain := Created_Task;
kono
parents:
diff changeset
659 end Create_Restricted_Task_Sequential;
kono
parents:
diff changeset
660
kono
parents:
diff changeset
661 ---------------------------
kono
parents:
diff changeset
662 -- Finalize_Global_Tasks --
kono
parents:
diff changeset
663 ---------------------------
kono
parents:
diff changeset
664
kono
parents:
diff changeset
665 -- This is needed to support the compiler interface; it will only be called
kono
parents:
diff changeset
666 -- by the Environment task. Instead, it will cause the Environment to block
kono
parents:
diff changeset
667 -- forever, since none of the dependent tasks are expected to terminate
kono
parents:
diff changeset
668
kono
parents:
diff changeset
669 procedure Finalize_Global_Tasks is
kono
parents:
diff changeset
670 Self_ID : constant Task_Id := STPO.Self;
kono
parents:
diff changeset
671
kono
parents:
diff changeset
672 begin
kono
parents:
diff changeset
673 pragma Assert (Self_ID = STPO.Environment_Task);
kono
parents:
diff changeset
674
kono
parents:
diff changeset
675 if Single_Lock then
kono
parents:
diff changeset
676 Lock_RTS;
kono
parents:
diff changeset
677 end if;
kono
parents:
diff changeset
678
kono
parents:
diff changeset
679 -- Handle normal task termination by the environment task, but only for
kono
parents:
diff changeset
680 -- the normal task termination. In the case of Abnormal and
kono
parents:
diff changeset
681 -- Unhandled_Exception they must have been handled before, and the task
kono
parents:
diff changeset
682 -- termination soft link must have been changed so the task termination
kono
parents:
diff changeset
683 -- routine is not executed twice.
kono
parents:
diff changeset
684
kono
parents:
diff changeset
685 -- Note that in the "normal" implementation in s-tassta.adb the task
kono
parents:
diff changeset
686 -- termination procedure for the environment task should be executed
kono
parents:
diff changeset
687 -- after termination of library-level tasks. However, this
kono
parents:
diff changeset
688 -- implementation is to be used when the Ravenscar restrictions are in
kono
parents:
diff changeset
689 -- effect, and AI-394 says that if there is a fall-back handler set for
kono
parents:
diff changeset
690 -- the partition it should be called when the first task (including the
kono
parents:
diff changeset
691 -- environment task) attempts to terminate.
kono
parents:
diff changeset
692
kono
parents:
diff changeset
693 SSL.Task_Termination_Handler.all (Ada.Exceptions.Null_Occurrence);
kono
parents:
diff changeset
694
kono
parents:
diff changeset
695 Write_Lock (Self_ID);
kono
parents:
diff changeset
696 Sleep (Self_ID, Master_Completion_Sleep);
kono
parents:
diff changeset
697 Unlock (Self_ID);
kono
parents:
diff changeset
698
kono
parents:
diff changeset
699 if Single_Lock then
kono
parents:
diff changeset
700 Unlock_RTS;
kono
parents:
diff changeset
701 end if;
kono
parents:
diff changeset
702
kono
parents:
diff changeset
703 -- Should never return from Master Completion Sleep
kono
parents:
diff changeset
704
kono
parents:
diff changeset
705 raise Program_Error;
kono
parents:
diff changeset
706 end Finalize_Global_Tasks;
kono
parents:
diff changeset
707
kono
parents:
diff changeset
708 ---------------------------
kono
parents:
diff changeset
709 -- Restricted_Terminated --
kono
parents:
diff changeset
710 ---------------------------
kono
parents:
diff changeset
711
kono
parents:
diff changeset
712 function Restricted_Terminated (T : Task_Id) return Boolean is
kono
parents:
diff changeset
713 begin
kono
parents:
diff changeset
714 return T.Common.State = Terminated;
kono
parents:
diff changeset
715 end Restricted_Terminated;
kono
parents:
diff changeset
716
kono
parents:
diff changeset
717 --------------------
kono
parents:
diff changeset
718 -- Terminate_Task --
kono
parents:
diff changeset
719 --------------------
kono
parents:
diff changeset
720
kono
parents:
diff changeset
721 procedure Terminate_Task (Self_ID : Task_Id) is
kono
parents:
diff changeset
722 begin
kono
parents:
diff changeset
723 Self_ID.Common.State := Terminated;
kono
parents:
diff changeset
724 end Terminate_Task;
kono
parents:
diff changeset
725
kono
parents:
diff changeset
726 --------------
kono
parents:
diff changeset
727 -- Init_RTS --
kono
parents:
diff changeset
728 --------------
kono
parents:
diff changeset
729
kono
parents:
diff changeset
730 procedure Init_RTS is
kono
parents:
diff changeset
731 begin
kono
parents:
diff changeset
732 Tasking.Initialize;
kono
parents:
diff changeset
733
kono
parents:
diff changeset
734 -- Initialize lock used to implement mutual exclusion between all tasks
kono
parents:
diff changeset
735
kono
parents:
diff changeset
736 STPO.Initialize_Lock (Global_Task_Lock'Access, STPO.Global_Task_Level);
kono
parents:
diff changeset
737
kono
parents:
diff changeset
738 -- Notify that the tasking run time has been elaborated so that
kono
parents:
diff changeset
739 -- the tasking version of the soft links can be used.
kono
parents:
diff changeset
740
kono
parents:
diff changeset
741 SSL.Lock_Task := Task_Lock'Access;
kono
parents:
diff changeset
742 SSL.Unlock_Task := Task_Unlock'Access;
kono
parents:
diff changeset
743 SSL.Adafinal := Finalize_Global_Tasks'Access;
kono
parents:
diff changeset
744 SSL.Get_Current_Excep := Get_Current_Excep'Access;
kono
parents:
diff changeset
745
kono
parents:
diff changeset
746 -- Initialize the tasking soft links (if not done yet) that are common
kono
parents:
diff changeset
747 -- to the full and the restricted run times.
kono
parents:
diff changeset
748
kono
parents:
diff changeset
749 SSL.Tasking.Init_Tasking_Soft_Links;
kono
parents:
diff changeset
750 end Init_RTS;
kono
parents:
diff changeset
751
kono
parents:
diff changeset
752 begin
kono
parents:
diff changeset
753 Init_RTS;
kono
parents:
diff changeset
754 end System.Tasking.Restricted.Stages;