PR target/16201
[official-gcc.git] / gcc / ada / s-tasinf-irix.ads
blob2954f8ee66cd3bcacc94b9001572da21b4c1981b
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . T A S K _ I N F O --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
10 -- --
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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
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. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
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
46 with Interfaces.C;
47 with System.OS_Interface;
49 package System.Task_Info is
50 pragma Elaborate_Body;
51 -- To ensure that a body is allowed
53 package OSI renames System.OS_Interface;
55 -----------------------------------------
56 -- Implementation of Task_Info Feature --
57 -----------------------------------------
59 -- Pragma Task_Info allows an application to set the underlying
60 -- pthread scheduling attributes for a specific task.
62 ------------------
63 -- Declarations --
64 ------------------
66 type Thread_Scheduling_Scope is
67 (PTHREAD_SCOPE_PROCESS, PTHREAD_SCOPE_SYSTEM);
69 for Thread_Scheduling_Scope'Size use Interfaces.C.int'Size;
71 type Thread_Scheduling_Inheritance is
72 (PTHREAD_EXPLICIT_SCHED, PTHREAD_INHERIT_SCHED);
74 for Thread_Scheduling_Inheritance'Size use Interfaces.C.int'Size;
76 type Thread_Scheduling_Policy is
77 (SCHED_FIFO, -- The first-in-first-out real-time policy
78 SCHED_RR, -- The round-robin real-time scheduling policy
79 SCHED_TS); -- The timeshare earnings based scheduling policy
81 for Thread_Scheduling_Policy'Size use Interfaces.C.int'Size;
82 for Thread_Scheduling_Policy use
83 (SCHED_FIFO => 1,
84 SCHED_RR => 2,
85 SCHED_TS => 3);
87 function SCHED_OTHER return Thread_Scheduling_Policy renames SCHED_TS;
89 No_Specified_Priority : constant := -1;
91 subtype Thread_Scheduling_Priority is Integer range
92 No_Specified_Priority .. 255;
94 function Min (Policy : Interfaces.C.int) return Interfaces.C.int
95 renames OSI.sched_get_priority_min;
97 function Max (Policy : Interfaces.C.int) return Interfaces.C.int
98 renames OSI.sched_get_priority_max;
100 subtype FIFO_Priority is Thread_Scheduling_Priority range
101 Thread_Scheduling_Priority (Min (OSI.SCHED_FIFO)) ..
102 Thread_Scheduling_Priority (Max (OSI.SCHED_FIFO));
104 subtype RR_Priority is Thread_Scheduling_Priority range
105 Thread_Scheduling_Priority (Min (OSI.SCHED_RR)) ..
106 Thread_Scheduling_Priority (Max (OSI.SCHED_RR));
108 subtype TS_Priority is Thread_Scheduling_Priority range
109 Thread_Scheduling_Priority (Min (OSI.SCHED_TS)) ..
110 Thread_Scheduling_Priority (Max (OSI.SCHED_TS));
112 subtype OTHER_Priority is Thread_Scheduling_Priority range
113 Thread_Scheduling_Priority (Min (OSI.SCHED_OTHER)) ..
114 Thread_Scheduling_Priority (Max (OSI.SCHED_OTHER));
116 subtype CPU_Number is Integer range -1 .. Integer'Last;
117 ANY_CPU : constant CPU_Number := CPU_Number'First;
119 type Thread_Attributes is record
120 Scope : Thread_Scheduling_Scope := PTHREAD_SCOPE_PROCESS;
121 Inheritance : Thread_Scheduling_Inheritance := PTHREAD_EXPLICIT_SCHED;
122 Policy : Thread_Scheduling_Policy := SCHED_RR;
123 Priority : Thread_Scheduling_Priority := No_Specified_Priority;
124 Runon_CPU : CPU_Number := ANY_CPU;
125 end record;
127 Default_Thread_Attributes : constant Thread_Attributes :=
128 (PTHREAD_SCOPE_PROCESS, PTHREAD_EXPLICIT_SCHED, SCHED_RR,
129 No_Specified_Priority, ANY_CPU);
131 type Task_Info_Type is access all Thread_Attributes;
133 Unspecified_Task_Info : constant Task_Info_Type := null;
134 -- Value passed to task in the absence of a Task_Info pragma
136 end System.Task_Info;