1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
11 -- GNARL 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 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
30 ------------------------------------------------------------------------------
32 -- This is a no tasking version of this package
34 -- This package contains all the GNULL primitives that interface directly with
38 -- Turn off polling, we do not want ATC polling to take place during tasking
39 -- operations. It causes infinite loops and other problems.
41 package body System.Task_Primitives.Operations is
44 use System.Parameters;
46 pragma Warnings (Off);
47 -- Turn off warnings since so many unreferenced parameters
53 procedure Abort_Task (T : Task_Id) is
62 function Check_Exit (Self_ID : ST.Task_Id) return Boolean is
71 function Check_No_Locks (Self_ID : ST.Task_Id) return Boolean is
80 function Continue_Task (T : ST.Task_Id) return Boolean is
89 function Current_State (S : Suspension_Object) return Boolean is
94 ----------------------
95 -- Environment_Task --
96 ----------------------
98 function Environment_Task return Task_Id is
101 end Environment_Task;
107 procedure Create_Task
109 Wrapper : System.Address;
110 Stack_Size : System.Parameters.Size_Type;
111 Priority : System.Any_Priority;
112 Succeeded : out Boolean)
122 procedure Enter_Task (Self_ID : Task_Id) is
131 procedure Exit_Task is
140 procedure Finalize (S : in out Suspension_Object) is
149 procedure Finalize_Lock (L : not null access Lock) is
154 procedure Finalize_Lock (L : not null access RTS_Lock) is
163 procedure Finalize_TCB (T : Task_Id) is
172 function Get_Priority (T : Task_Id) return System.Any_Priority is
181 function Get_Thread_Id (T : ST.Task_Id) return OSI.Thread_Id is
183 return OSI.Thread_Id (T.Common.LL.Thread);
190 procedure Initialize (Environment_Task : Task_Id) is
191 No_Tasking : Boolean;
193 raise Program_Error with "tasking not implemented on this configuration";
196 procedure Initialize (S : in out Suspension_Object) is
201 ---------------------
202 -- Initialize_Lock --
203 ---------------------
205 procedure Initialize_Lock
206 (Prio : System.Any_Priority;
207 L : not null access Lock)
213 procedure Initialize_Lock
214 (L : not null access RTS_Lock; Level : Lock_Level) is
223 procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is
232 function Is_Valid_Task return Boolean is
241 procedure Lock_RTS is
246 ---------------------
247 -- Monotonic_Clock --
248 ---------------------
250 function Monotonic_Clock return Duration is
259 function New_ATCB (Entry_Num : Task_Entry_Index) return Task_Id is
261 return new Ada_Task_Control_Block (Entry_Num);
269 (L : not null access Lock;
270 Ceiling_Violation : out Boolean)
273 Ceiling_Violation := False;
276 -----------------------------
277 -- Register_Foreign_Thread --
278 -----------------------------
280 function Register_Foreign_Thread return Task_Id is
283 end Register_Foreign_Thread;
291 Thread_Self : OSI.Thread_Id) return Boolean
301 function RT_Resolution return Duration is
310 function Self return Task_Id is
319 procedure Set_Ceiling
320 (L : not null access Lock;
321 Prio : System.Any_Priority)
331 procedure Set_False (S : in out Suspension_Object) is
340 procedure Set_Priority
342 Prio : System.Any_Priority;
343 Loss_Of_Inheritance : Boolean := False)
353 procedure Set_True (S : in out Suspension_Object) is
362 procedure Sleep (Self_ID : Task_Id; Reason : System.Tasking.Task_States) is
371 procedure Stack_Guard (T : ST.Task_Id; On : Boolean) is
380 function Suspend_Task
382 Thread_Self : OSI.Thread_Id) return Boolean
392 procedure Stop_All_Tasks is
401 function Stop_Task (T : ST.Task_Id) return Boolean is
402 pragma Unreferenced (T);
407 ------------------------
408 -- Suspend_Until_True --
409 ------------------------
411 procedure Suspend_Until_True (S : in out Suspension_Object) is
414 end Suspend_Until_True;
420 procedure Timed_Delay
423 Mode : ST.Delay_Modes)
433 procedure Timed_Sleep
436 Mode : ST.Delay_Modes;
437 Reason : System.Tasking.Task_States;
438 Timedout : out Boolean;
439 Yielded : out Boolean)
450 procedure Unlock (L : not null access Lock) is
456 (L : not null access RTS_Lock;
457 Global_Lock : Boolean := False)
463 procedure Unlock (T : Task_Id) is
472 procedure Unlock_RTS is
480 procedure Wakeup (T : Task_Id; Reason : System.Tasking.Task_States) is
490 (L : not null access Lock;
491 Ceiling_Violation : out Boolean)
494 Ceiling_Violation := False;
498 (L : not null access RTS_Lock;
499 Global_Lock : Boolean := False)
505 procedure Write_Lock (T : Task_Id) is
514 procedure Yield (Do_Yield : Boolean := True) is
519 end System.Task_Primitives.Operations;