1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
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 |
|
|
package System.Task_Info is
|
43 |
|
|
pragma Preelaborate;
|
44 |
|
|
pragma Elaborate_Body;
|
45 |
|
|
-- To ensure that a body is allowed
|
46 |
|
|
|
47 |
|
|
-----------------------------------------
|
48 |
|
|
-- Implementation of Task_Info Feature --
|
49 |
|
|
-----------------------------------------
|
50 |
|
|
|
51 |
|
|
-- The Task_Info pragma:
|
52 |
|
|
|
53 |
|
|
-- pragma Task_Info (EXPRESSION);
|
54 |
|
|
|
55 |
|
|
-- allows the specification on a task by task basis of a value of type
|
56 |
|
|
-- System.Task_Info.Task_Info_Type to be passed to a task when it is
|
57 |
|
|
-- created. The specification of this type, and the effect on the task
|
58 |
|
|
-- that is created is target dependent.
|
59 |
|
|
|
60 |
|
|
-- The Task_Info pragma appears within a task definition (compare the
|
61 |
|
|
-- definition and implementation of pragma Priority). If no such pragma
|
62 |
|
|
-- appears, then the value Unspecified_Task_Info is passed. If a pragma
|
63 |
|
|
-- is present, then it supplies an alternative value. If the argument of
|
64 |
|
|
-- the pragma is a discriminant reference, then the value can be set on
|
65 |
|
|
-- a task by task basis by supplying the appropriate discriminant value.
|
66 |
|
|
|
67 |
|
|
-- Note that this means that the type used for Task_Info_Type must be
|
68 |
|
|
-- suitable for use as a discriminant (i.e. a scalar or access type).
|
69 |
|
|
|
70 |
|
|
------------------
|
71 |
|
|
-- Declarations --
|
72 |
|
|
------------------
|
73 |
|
|
|
74 |
|
|
type Scope_Type is
|
75 |
|
|
(Process_Scope,
|
76 |
|
|
-- Contend only with threads in same process
|
77 |
|
|
|
78 |
|
|
System_Scope,
|
79 |
|
|
-- Contend with all threads on same CPU
|
80 |
|
|
|
81 |
|
|
Default_Scope);
|
82 |
|
|
|
83 |
|
|
type Task_Info_Type is new Scope_Type;
|
84 |
|
|
-- Type used for passing information to task create call, using the
|
85 |
|
|
-- Task_Info pragma. This type may be specialized for individual
|
86 |
|
|
-- implementations, but it must be a type that can be used as a
|
87 |
|
|
-- discriminant (i.e. a scalar or access type).
|
88 |
|
|
|
89 |
|
|
Unspecified_Task_Info : constant Task_Info_Type := Default_Scope;
|
90 |
|
|
-- Value passed to task in the absence of a Task_Info pragma
|
91 |
|
|
|
92 |
|
|
end System.Task_Info;
|