1 ------------------------------------------------------------------------------
3 -- GNU ADA 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 --
10 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
12 -- GNARL is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNARL; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
30 -- GNARL was developed by the GNARL team at Florida State University. It is --
31 -- now maintained by Ada Core Technologies, Inc. (http://www.gnat.com). --
33 ------------------------------------------------------------------------------
35 -- This is a no tasking version of this package
37 -- This package contains all the GNULL primitives that interface directly
38 -- with the underlying OS.
41 -- Turn off polling, we do not want ATC polling to take place during
42 -- tasking operations. It causes infinite loops and other problems.
45 -- used for Ada_Task_Control_Block
48 with System
.Error_Reporting
;
51 package body System
.Task_Primitives
.Operations
is
54 use System
.Parameters
;
60 procedure Stack_Guard
(T
: ST
.Task_ID
; On
: Boolean) is
69 function Get_Thread_Id
(T
: ST
.Task_ID
) return OSI
.Thread_Id
is
71 return OSI
.Thread_Id
(T
.Common
.LL
.Thread
);
78 function Self
return Task_ID
is
87 procedure Initialize_Lock
88 (Prio
: System
.Any_Priority
;
94 procedure Initialize_Lock
(L
: access RTS_Lock
; Level
: Lock_Level
) is
103 procedure Finalize_Lock
(L
: access Lock
) is
108 procedure Finalize_Lock
(L
: access RTS_Lock
) is
117 procedure Write_Lock
(L
: access Lock
; Ceiling_Violation
: out Boolean) is
119 Ceiling_Violation
:= False;
123 (L
: access RTS_Lock
; Global_Lock
: Boolean := False)
129 procedure Write_Lock
(T
: Task_ID
) is
138 procedure Read_Lock
(L
: access Lock
; Ceiling_Violation
: out Boolean) is
140 Ceiling_Violation
:= False;
147 procedure Unlock
(L
: access Lock
) is
152 procedure Unlock
(L
: access RTS_Lock
; Global_Lock
: Boolean := False) is
157 procedure Unlock
(T
: Task_ID
) is
166 procedure Sleep
(Self_ID
: Task_ID
; Reason
: System
.Tasking
.Task_States
) is
175 procedure Timed_Sleep
178 Mode
: ST
.Delay_Modes
;
179 Reason
: System
.Tasking
.Task_States
;
180 Timedout
: out Boolean;
181 Yielded
: out Boolean) is
191 procedure Timed_Delay
194 Mode
: ST
.Delay_Modes
) is
199 ---------------------
200 -- Monotonic_Clock --
201 ---------------------
203 function Monotonic_Clock
return Duration is
212 function RT_Resolution
return Duration is
221 procedure Wakeup
(T
: Task_ID
; Reason
: System
.Tasking
.Task_States
) is
230 procedure Set_Priority
232 Prio
: System
.Any_Priority
;
233 Loss_Of_Inheritance
: Boolean := False) is
242 function Get_Priority
(T
: Task_ID
) return System
.Any_Priority
is
251 procedure Enter_Task
(Self_ID
: Task_ID
) is
260 function New_ATCB
(Entry_Num
: Task_Entry_Index
) return Task_ID
is
262 return new Ada_Task_Control_Block
(Entry_Num
);
265 ----------------------
267 ----------------------
269 procedure Initialize_TCB
(Self_ID
: Task_ID
; Succeeded
: out Boolean) is
278 procedure Create_Task
280 Wrapper
: System
.Address
;
281 Stack_Size
: System
.Parameters
.Size_Type
;
282 Priority
: System
.Any_Priority
;
283 Succeeded
: out Boolean) is
292 procedure Finalize_TCB
(T
: Task_ID
) is
301 procedure Exit_Task
is
310 procedure Abort_Task
(T
: Task_ID
) is
319 procedure Yield
(Do_Yield
: Boolean := True) is
328 -- Dummy versions. The only currently working versions is for solaris
331 function Check_Exit
(Self_ID
: ST
.Task_ID
) return Boolean is
340 function Check_No_Locks
(Self_ID
: ST
.Task_ID
) return Boolean is
345 ----------------------
346 -- Environment_Task --
347 ----------------------
349 function Environment_Task
return Task_ID
is
352 end Environment_Task
;
358 procedure Lock_RTS
is
367 procedure Unlock_RTS
is
376 function Suspend_Task
378 Thread_Self
: OSI
.Thread_Id
) return Boolean is
389 Thread_Self
: OSI
.Thread_Id
) return Boolean is
398 procedure Initialize
(Environment_Task
: Task_ID
) is
403 No_Tasking
: Boolean;
406 -- Can't raise an exception because target independent packages try to
407 -- do an Abort_Defer, which gets a memory fault.
410 System
.Error_Reporting
.Shutdown
411 ("Tasking not implemented on this configuration");
412 end System
.Task_Primitives
.Operations
;