annotate gcc/ada/libgnarl/s-tasinf__solaris.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . T A S K _ I N F O --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package contains the definitions and routines associated with the
kono
parents:
diff changeset
33 -- implementation and use of the Task_Info pragma. It is specialized
kono
parents:
diff changeset
34 -- appropriately for targets that make use of this pragma.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
kono
parents:
diff changeset
37 -- Any changes to this interface may require corresponding compiler changes.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 -- The functionality in this unit is now provided by the predefined package
kono
parents:
diff changeset
40 -- System.Multiprocessors and the CPU aspect. This package is obsolescent.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 -- This is the Solaris (native) version of this module
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 with System.OS_Interface;
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 package System.Task_Info is
kono
parents:
diff changeset
47 pragma Obsolescent (Task_Info, "use System.Multiprocessors and CPU aspect");
kono
parents:
diff changeset
48 pragma Preelaborate;
kono
parents:
diff changeset
49 pragma Elaborate_Body;
kono
parents:
diff changeset
50 -- To ensure that a body is allowed
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 -----------------------------------------------------
kono
parents:
diff changeset
53 -- Binding of Tasks to LWPs and LWPs to processors --
kono
parents:
diff changeset
54 -----------------------------------------------------
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 -- The Solaris implementation of the GNU Low-Level Interface (GNULLI)
kono
parents:
diff changeset
57 -- implements each Ada task as a Solaris thread. The Solaris thread
kono
parents:
diff changeset
58 -- library distributes threads across one or more LWPs (Light Weight
kono
parents:
diff changeset
59 -- Process) that are members of the same process. Solaris distributes
kono
parents:
diff changeset
60 -- processes and LWPs across the available CPUs on a given machine. The
kono
parents:
diff changeset
61 -- pragma Task_Info provides the mechanism to control the distribution
kono
parents:
diff changeset
62 -- of tasks to LWPs, and LWPs to processors.
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 -- Each thread has a number of attributes that dictate it's scheduling.
kono
parents:
diff changeset
65 -- These attributes are:
kono
parents:
diff changeset
66 --
kono
parents:
diff changeset
67 -- New_LWP: whether a new LWP is created for this thread.
kono
parents:
diff changeset
68 --
kono
parents:
diff changeset
69 -- Bound_To_LWP: whether the thread is bound to a specific LWP
kono
parents:
diff changeset
70 -- for its entire lifetime.
kono
parents:
diff changeset
71 --
kono
parents:
diff changeset
72 -- CPU: the CPU number associated to the LWP
kono
parents:
diff changeset
73 --
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 -- The Task_Info pragma:
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 -- pragma Task_Info (EXPRESSION);
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 -- allows the specification on a task by task basis of a value of type
kono
parents:
diff changeset
80 -- System.Task_Info.Task_Info_Type to be passed to a task when it is
kono
parents:
diff changeset
81 -- created. The specification of this type, and the effect on the task
kono
parents:
diff changeset
82 -- that is created is target dependent.
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 -- The Task_Info pragma appears within a task definition (compare the
kono
parents:
diff changeset
85 -- definition and implementation of pragma Priority). If no such pragma
kono
parents:
diff changeset
86 -- appears, then the value Unspecified_Task_Info is passed. If a pragma
kono
parents:
diff changeset
87 -- is present, then it supplies an alternative value. If the argument of
kono
parents:
diff changeset
88 -- the pragma is a discriminant reference, then the value can be set on
kono
parents:
diff changeset
89 -- a task by task basis by supplying the appropriate discriminant value.
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 -- Note that this means that the type used for Task_Info_Type must be
kono
parents:
diff changeset
92 -- suitable for use as a discriminant (i.e. a scalar or access type).
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 -----------------------
kono
parents:
diff changeset
95 -- Thread Attributes --
kono
parents:
diff changeset
96 -----------------------
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 subtype CPU_Number is System.OS_Interface.processorid_t;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 CPU_UNCHANGED : constant CPU_Number := System.OS_Interface.PBIND_QUERY;
kono
parents:
diff changeset
101 -- Do not bind the LWP to a specific processor
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 ANY_CPU : constant CPU_Number := System.OS_Interface.PBIND_NONE;
kono
parents:
diff changeset
104 -- Bind the LWP to any processor
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 Invalid_CPU_Number : exception;
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 type Thread_Attributes (New_LWP : Boolean) is record
kono
parents:
diff changeset
109 Bound_To_LWP : Boolean := True;
kono
parents:
diff changeset
110 case New_LWP is
kono
parents:
diff changeset
111 when False =>
kono
parents:
diff changeset
112 null;
kono
parents:
diff changeset
113 when True =>
kono
parents:
diff changeset
114 CPU : CPU_Number := CPU_UNCHANGED;
kono
parents:
diff changeset
115 end case;
kono
parents:
diff changeset
116 end record;
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 Default_Thread_Attributes : constant Thread_Attributes := (False, True);
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 function Unbound_Thread_Attributes
kono
parents:
diff changeset
121 return Thread_Attributes;
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 function Bound_Thread_Attributes
kono
parents:
diff changeset
124 return Thread_Attributes;
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 function Bound_Thread_Attributes (CPU : CPU_Number)
kono
parents:
diff changeset
127 return Thread_Attributes;
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 type Task_Info_Type is access all Thread_Attributes;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 function New_Unbound_Thread_Attributes
kono
parents:
diff changeset
132 return Task_Info_Type;
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 function New_Bound_Thread_Attributes
kono
parents:
diff changeset
135 return Task_Info_Type;
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 function New_Bound_Thread_Attributes (CPU : CPU_Number)
kono
parents:
diff changeset
138 return Task_Info_Type;
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 Unspecified_Task_Info : constant Task_Info_Type := null;
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 end System.Task_Info;