Add x prefix to v850e case for handling --with-cpu=v850e.
[official-gcc.git] / gcc / ada / 5ftasinf.ads
blob3aebdb6bda9427ad7e10924681309420056e51f1
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 -- (Compiler Interface) --
9 -- --
10 -- --
11 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 -- --
34 ------------------------------------------------------------------------------
36 -- This package contains the definitions and routines associated with the
37 -- implementation of the Task_Info pragma. It is specialized appropriately
38 -- for targets that make use of this pragma.
40 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
41 -- Any changes to this interface may require corresponding compiler changes.
43 with Interfaces.C;
44 with System.OS_Interface;
45 with Unchecked_Deallocation;
47 package System.Task_Info is
48 pragma Elaborate_Body;
49 -- To ensure that a body is allowed
51 package OSI renames System.OS_Interface;
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.
60 ------------------
61 -- Declarations --
62 ------------------
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
81 (SCHED_FIFO => 1,
82 SCHED_RR => 2,
83 SCHED_TS => 3);
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 function Min (Policy : Interfaces.C.int) return Interfaces.C.int
93 renames OSI.sched_get_priority_min;
95 function Max (Policy : Interfaces.C.int) return Interfaces.C.int
96 renames OSI.sched_get_priority_max;
98 subtype FIFO_Priority is Thread_Scheduling_Priority range
99 Thread_Scheduling_Priority (Min (OSI.SCHED_FIFO)) ..
100 Thread_Scheduling_Priority (Max (OSI.SCHED_FIFO));
102 subtype RR_Priority is Thread_Scheduling_Priority range
103 Thread_Scheduling_Priority (Min (OSI.SCHED_RR)) ..
104 Thread_Scheduling_Priority (Max (OSI.SCHED_RR));
106 subtype TS_Priority is Thread_Scheduling_Priority range
107 Thread_Scheduling_Priority (Min (OSI.SCHED_TS)) ..
108 Thread_Scheduling_Priority (Max (OSI.SCHED_TS));
110 subtype OTHER_Priority is Thread_Scheduling_Priority range
111 Thread_Scheduling_Priority (Min (OSI.SCHED_OTHER)) ..
112 Thread_Scheduling_Priority (Max (OSI.SCHED_OTHER));
114 subtype CPU_Number is Integer range -1 .. Integer'Last;
115 ANY_CPU : constant CPU_Number := CPU_Number'First;
117 type Thread_Attributes is record
118 Scope : Thread_Scheduling_Scope := PTHREAD_SCOPE_PROCESS;
119 Inheritance : Thread_Scheduling_Inheritance := PTHREAD_EXPLICIT_SCHED;
120 Policy : Thread_Scheduling_Policy := SCHED_RR;
121 Priority : Thread_Scheduling_Priority := No_Specified_Priority;
122 Runon_CPU : CPU_Number := ANY_CPU;
123 end record;
125 Default_Thread_Attributes : constant Thread_Attributes :=
126 (PTHREAD_SCOPE_PROCESS, PTHREAD_EXPLICIT_SCHED, SCHED_RR,
127 No_Specified_Priority, ANY_CPU);
129 type Task_Info_Type is access all Thread_Attributes;
131 type Task_Image_Type is access String;
132 -- Used to generate a meaningful identifier for tasks that are variables
133 -- and components of variables.
135 procedure Free_Task_Image is new
136 Unchecked_Deallocation (String, Task_Image_Type);
138 Unspecified_Task_Info : constant Task_Info_Type := null;
139 -- Value passed to task in the absence of a Task_Info pragma
141 end System.Task_Info;