OSDN Git Service

* a-calend-mingw.adb: Add call to OS_Primitives.Initialize;
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tasinf-irix.ads
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-2005 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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 ------------------------------------------------------------------------------
33
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.
37
38 --  Note: the compiler generates direct calls to this interface, via Rtsfind.
39 --  Any changes to this interface may require corresponding compiler changes.
40
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.
43
44 --  This is the IRIX (kernel threads) version of this package
45
46 with Interfaces.C;
47
48 package System.Task_Info is
49    pragma Preelaborate;
50    pragma Elaborate_Body;
51    --  To ensure that a body is allowed
52
53    -----------------------------------------
54    -- Implementation of Task_Info Feature --
55    -----------------------------------------
56
57    --  Pragma Task_Info allows an application to set the underlying
58    --  pthread scheduling attributes for a specific task.
59
60    ------------------
61    -- Declarations --
62    ------------------
63
64    type Thread_Scheduling_Scope is
65      (PTHREAD_SCOPE_PROCESS, PTHREAD_SCOPE_SYSTEM);
66
67    for Thread_Scheduling_Scope'Size use Interfaces.C.int'Size;
68
69    type Thread_Scheduling_Inheritance is
70       (PTHREAD_EXPLICIT_SCHED, PTHREAD_INHERIT_SCHED);
71
72    for Thread_Scheduling_Inheritance'Size use Interfaces.C.int'Size;
73
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
78
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);
84
85    function SCHED_OTHER return Thread_Scheduling_Policy renames SCHED_TS;
86
87    No_Specified_Priority : constant := -1;
88
89    subtype Thread_Scheduling_Priority is Integer range
90      No_Specified_Priority .. 255;
91
92    subtype FIFO_Priority is Thread_Scheduling_Priority range 0 .. 255;
93
94    subtype RR_Priority is Thread_Scheduling_Priority range 0 .. 255;
95
96    subtype TS_Priority is Thread_Scheduling_Priority range 1 .. 40;
97
98    subtype OTHER_Priority is Thread_Scheduling_Priority range 1 .. 40;
99
100    subtype CPU_Number is Integer range -1 .. Integer'Last;
101    ANY_CPU : constant CPU_Number := CPU_Number'First;
102
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;
109    end record;
110
111    Default_Thread_Attributes : constant Thread_Attributes :=
112      (PTHREAD_SCOPE_PROCESS, PTHREAD_EXPLICIT_SCHED, SCHED_RR,
113        No_Specified_Priority, ANY_CPU);
114
115    type Task_Info_Type is access all Thread_Attributes;
116
117    Unspecified_Task_Info : constant Task_Info_Type := null;
118    --  Value passed to task in the absence of a Task_Info pragma
119
120 end System.Task_Info;