1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . T A S K _ I N F O --
9 -- Copyright (C) 1992-2009 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 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 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package contains the definitions and routines associated with the
33 -- implementation and use of the Task_Info pragma. It is specialized
34 -- appropriately for targets that make use of this pragma.
36 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
37 -- Any changes to this interface may require corresponding compiler changes.
39 -- This unit may be used directly from an application program by providing
40 -- an appropriate WITH, and the interface can be expected to remain stable.
42 -- This is the IRIX (kernel threads) version of this package
46 package System.Task_Info is
48 pragma Elaborate_Body;
49 -- To ensure that a body is allowed
51 -----------------------------------------
52 -- Implementation of Task_Info Feature --
53 -----------------------------------------
55 -- Pragma Task_Info allows an application to set the underlying
56 -- pthread scheduling attributes for a specific task.
62 type Thread_Scheduling_Scope is
63 (PTHREAD_SCOPE_PROCESS, PTHREAD_SCOPE_SYSTEM);
65 for Thread_Scheduling_Scope'Size use Interfaces.C.int'Size;
67 type Thread_Scheduling_Inheritance is
68 (PTHREAD_EXPLICIT_SCHED, PTHREAD_INHERIT_SCHED);
70 for Thread_Scheduling_Inheritance'Size use Interfaces.C.int'Size;
72 type Thread_Scheduling_Policy is
73 (SCHED_FIFO, -- The first-in-first-out real-time policy
74 SCHED_RR, -- The round-robin real-time scheduling policy
75 SCHED_TS); -- The timeshare earnings based scheduling policy
77 for Thread_Scheduling_Policy'Size use Interfaces.C.int'Size;
78 for Thread_Scheduling_Policy use
83 function SCHED_OTHER return Thread_Scheduling_Policy renames SCHED_TS;
85 No_Specified_Priority : constant := -1;
87 subtype Thread_Scheduling_Priority is Integer range
88 No_Specified_Priority .. 255;
90 subtype FIFO_Priority is Thread_Scheduling_Priority range 0 .. 255;
92 subtype RR_Priority is Thread_Scheduling_Priority range 0 .. 255;
94 subtype TS_Priority is Thread_Scheduling_Priority range 1 .. 40;
96 subtype OTHER_Priority is Thread_Scheduling_Priority range 1 .. 40;
98 subtype CPU_Number is Integer range -1 .. Integer'Last;
99 ANY_CPU : constant CPU_Number := CPU_Number'First;
101 type Thread_Attributes is record
102 Scope : Thread_Scheduling_Scope := PTHREAD_SCOPE_PROCESS;
103 Inheritance : Thread_Scheduling_Inheritance := PTHREAD_EXPLICIT_SCHED;
104 Policy : Thread_Scheduling_Policy := SCHED_RR;
105 Priority : Thread_Scheduling_Priority := No_Specified_Priority;
106 Runon_CPU : CPU_Number := ANY_CPU;
109 Default_Thread_Attributes : constant Thread_Attributes :=
110 (PTHREAD_SCOPE_PROCESS, PTHREAD_EXPLICIT_SCHED, SCHED_RR,
111 No_Specified_Priority, ANY_CPU);
113 type Task_Info_Type is access all Thread_Attributes;
115 Unspecified_Task_Info : constant Task_Info_Type := null;
116 -- Value passed to task in the absence of a Task_Info pragma
118 end System.Task_Info;