1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . T A S K _ I N F O --
9 -- Copyright (C) 1992-2005 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- This package contains the definitions and routines associated with the
35 -- implementation and use of the Task_Info pragma. It is specialized
36 -- appropriately for targets that make use of this pragma.
38 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
39 -- Any changes to this interface may require corresponding compiler changes.
41 -- This unit may be used directly from an application program by providing
42 -- an appropriate WITH, and the interface can be expected to remain stable.
44 -- This is the IRIX (kernel threads) version of this package
48 package System
.Task_Info
is
50 pragma Elaborate_Body
;
51 -- To ensure that a body is allowed
53 -----------------------------------------
54 -- Implementation of Task_Info Feature --
55 -----------------------------------------
57 -- Pragma Task_Info allows an application to set the underlying
58 -- pthread scheduling attributes for a specific task.
64 type Thread_Scheduling_Scope
is
65 (PTHREAD_SCOPE_PROCESS
, PTHREAD_SCOPE_SYSTEM
);
67 for Thread_Scheduling_Scope
'Size use Interfaces
.C
.int
'Size;
69 type Thread_Scheduling_Inheritance
is
70 (PTHREAD_EXPLICIT_SCHED
, PTHREAD_INHERIT_SCHED
);
72 for Thread_Scheduling_Inheritance
'Size use Interfaces
.C
.int
'Size;
74 type Thread_Scheduling_Policy
is
75 (SCHED_FIFO
, -- The first-in-first-out real-time policy
76 SCHED_RR
, -- The round-robin real-time scheduling policy
77 SCHED_TS
); -- The timeshare earnings based scheduling policy
79 for Thread_Scheduling_Policy
'Size use Interfaces
.C
.int
'Size;
80 for Thread_Scheduling_Policy
use
85 function SCHED_OTHER
return Thread_Scheduling_Policy
renames SCHED_TS
;
87 No_Specified_Priority
: constant := -1;
89 subtype Thread_Scheduling_Priority
is Integer range
90 No_Specified_Priority
.. 255;
92 subtype FIFO_Priority
is Thread_Scheduling_Priority
range 0 .. 255;
94 subtype RR_Priority
is Thread_Scheduling_Priority
range 0 .. 255;
96 subtype TS_Priority
is Thread_Scheduling_Priority
range 1 .. 40;
98 subtype OTHER_Priority
is Thread_Scheduling_Priority
range 1 .. 40;
100 subtype CPU_Number
is Integer range -1 .. Integer'Last;
101 ANY_CPU
: constant CPU_Number
:= CPU_Number
'First;
103 type Thread_Attributes
is record
104 Scope
: Thread_Scheduling_Scope
:= PTHREAD_SCOPE_PROCESS
;
105 Inheritance
: Thread_Scheduling_Inheritance
:= PTHREAD_EXPLICIT_SCHED
;
106 Policy
: Thread_Scheduling_Policy
:= SCHED_RR
;
107 Priority
: Thread_Scheduling_Priority
:= No_Specified_Priority
;
108 Runon_CPU
: CPU_Number
:= ANY_CPU
;
111 Default_Thread_Attributes
: constant Thread_Attributes
:=
112 (PTHREAD_SCOPE_PROCESS
, PTHREAD_EXPLICIT_SCHED
, SCHED_RR
,
113 No_Specified_Priority
, ANY_CPU
);
115 type Task_Info_Type
is access all Thread_Attributes
;
117 Unspecified_Task_Info
: constant Task_Info_Type
:= null;
118 -- Value passed to task in the absence of a Task_Info pragma
120 end System
.Task_Info
;