1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . T A S K _ I N F O --
8 -- (Compiler Interface) --
10 -- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 3, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. --
19 -- As a special exception under Section 7 of GPL version 3, you are granted --
20 -- additional permissions described in the GCC Runtime Library Exception, --
21 -- version 3.1, as published by the Free Software Foundation. --
23 -- You should have received a copy of the GNU General Public License and --
24 -- a copy of the GCC Runtime Library Exception along with this program; --
25 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
26 -- <http://www.gnu.org/licenses/>. --
28 -- GNAT was originally developed by the GNAT team at New York University. --
29 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 ------------------------------------------------------------------------------
33 -- This package contains the definitions and routines associated with the
34 -- implementation and use of the Task_Info pragma. It is specialized
35 -- appropriately for targets that make use of this pragma.
37 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
38 -- Any changes to this interface may require corresponding compiler changes.
40 -- This unit may be used directly from an application program by providing
41 -- an appropriate WITH, and the interface can be expected to remain stable.
43 -- This is a DEC Unix 4.0d version of this package
45 package System
.Task_Info
is
47 pragma Elaborate_Body
;
48 -- To ensure that a body is allowed
50 -----------------------------------------
51 -- Implementation of Task_Info Feature --
52 -----------------------------------------
54 -- The Task_Info pragma:
56 -- pragma Task_Info (EXPRESSION);
58 -- allows the specification on a task by task basis of a value of type
59 -- System.Task_Info.Task_Info_Type to be passed to a task when it is
60 -- created. The specification of this type, and the effect on the task
61 -- that is created is target dependent.
63 -- The Task_Info pragma appears within a task definition (compare the
64 -- definition and implementation of pragma Priority). If no such pragma
65 -- appears, then the value Unspecified_Task_Info is passed. If a pragma
66 -- is present, then it supplies an alternative value. If the argument of
67 -- the pragma is a discriminant reference, then the value can be set on
68 -- a task by task basis by supplying the appropriate discriminant value.
70 -- Note that this means that the type used for Task_Info_Type must be
71 -- suitable for use as a discriminant (i.e. a scalar or access type).
79 -- Contend only with threads in same process
82 -- Contend with all threads on same CPU
86 type Thread_Attributes
is record
87 Bind_To_Cpu_Number
: Integer;
90 -- 1-N: Bind all unbound threads to this CPU
92 Contention_Scope
: Scope_Type
;
95 type Task_Info_Type
is access all Thread_Attributes
;
96 -- Type used for passing information to task create call, using the
97 -- Task_Info pragma. This type may be specialized for individual
98 -- implementations, but it must be a type that can be used as a
99 -- discriminant (i.e. a scalar or access type).
101 Unspecified_Thread_Attribute
: aliased Thread_Attributes
:=
102 Thread_Attributes
'(-1, Default_Scope);
104 Unspecified_Task_Info : constant Task_Info_Type :=
105 Unspecified_Thread_Attribute'Access;
106 -- Value passed to task in the absence of a Task_Info pragma
107 -- Don't call new here because the tasking run time has not been
108 -- elaborated yet, so calling Task_Lock is unsafe.
110 end System.Task_Info;