OSDN Git Service

PR ada/53766
[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-2009 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 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.                                     --
17 --                                                                          --
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.               --
21 --                                                                          --
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/>.                                          --
26 --                                                                          --
27 -- GNAT was originally developed  by the GNAT team at  New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
29 --                                                                          --
30 ------------------------------------------------------------------------------
31
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.
35
36 --  Note: the compiler generates direct calls to this interface, via Rtsfind.
37 --  Any changes to this interface may require corresponding compiler changes.
38
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.
41
42 --  This is the IRIX (kernel threads) version of this package
43
44 with Interfaces.C;
45
46 package System.Task_Info is
47    pragma Preelaborate;
48    pragma Elaborate_Body;
49    --  To ensure that a body is allowed
50
51    -----------------------------------------
52    -- Implementation of Task_Info Feature --
53    -----------------------------------------
54
55    --  Pragma Task_Info allows an application to set the underlying
56    --  pthread scheduling attributes for a specific task.
57
58    ------------------
59    -- Declarations --
60    ------------------
61
62    type Thread_Scheduling_Scope is
63      (PTHREAD_SCOPE_PROCESS, PTHREAD_SCOPE_SYSTEM);
64
65    for Thread_Scheduling_Scope'Size use Interfaces.C.int'Size;
66
67    type Thread_Scheduling_Inheritance is
68       (PTHREAD_EXPLICIT_SCHED, PTHREAD_INHERIT_SCHED);
69
70    for Thread_Scheduling_Inheritance'Size use Interfaces.C.int'Size;
71
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
76
77    for Thread_Scheduling_Policy'Size use Interfaces.C.int'Size;
78    for Thread_Scheduling_Policy use
79       (SCHED_FIFO => 1,
80        SCHED_RR   => 2,
81        SCHED_TS   => 3);
82
83    function SCHED_OTHER return Thread_Scheduling_Policy renames SCHED_TS;
84
85    No_Specified_Priority : constant := -1;
86
87    subtype Thread_Scheduling_Priority is Integer range
88      No_Specified_Priority .. 255;
89
90    subtype FIFO_Priority is Thread_Scheduling_Priority range 0 .. 255;
91
92    subtype RR_Priority is Thread_Scheduling_Priority range 0 .. 255;
93
94    subtype TS_Priority is Thread_Scheduling_Priority range 1 .. 40;
95
96    subtype OTHER_Priority is Thread_Scheduling_Priority range 1 .. 40;
97
98    subtype CPU_Number is Integer range -1 .. Integer'Last;
99    ANY_CPU : constant CPU_Number := CPU_Number'First;
100
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;
107    end record;
108
109    Default_Thread_Attributes : constant Thread_Attributes :=
110      (PTHREAD_SCOPE_PROCESS, PTHREAD_EXPLICIT_SCHED, SCHED_RR,
111        No_Specified_Priority, ANY_CPU);
112
113    type Task_Info_Type is access all Thread_Attributes;
114
115    Unspecified_Task_Info : constant Task_Info_Type := null;
116    --  Value passed to task in the absence of a Task_Info pragma
117
118 end System.Task_Info;