OSDN Git Service

2007-04-20 Vincent Celier <celier@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tasinf-tru64.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 --                           (Compiler Interface)                           --
9 --                                                                          --
10 --         Copyright (C) 1998-2005 Free Software Foundation, Inc.           --
11 --                                                                          --
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 2,  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.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
21 -- Boston, MA 02110-1301, USA.                                              --
22 --                                                                          --
23 -- As a special exception,  if other files  instantiate  generics from this --
24 -- unit, or you link  this unit with other files  to produce an executable, --
25 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
26 -- covered  by the  GNU  General  Public  License.  This exception does not --
27 -- however invalidate  any other reasons why  the executable file  might be --
28 -- covered by the  GNU Public License.                                      --
29 --                                                                          --
30 -- GNAT was originally developed  by the GNAT team at  New York University. --
31 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 --  This package contains the definitions and routines associated with the
36 --  implementation and use of the Task_Info pragma. It is specialized
37 --  appropriately for targets that make use of this pragma.
38
39 --  Note: the compiler generates direct calls to this interface, via Rtsfind.
40 --  Any changes to this interface may require corresponding compiler changes.
41
42 --  This unit may be used directly from an application program by providing
43 --  an appropriate WITH, and the interface can be expected to remain stable.
44
45 --  This is a DEC Unix 4.0d version of this package.
46
47 package System.Task_Info is
48    pragma Preelaborate;
49    pragma Elaborate_Body;
50    --  To ensure that a body is allowed
51
52    -----------------------------------------
53    -- Implementation of Task_Info Feature --
54    -----------------------------------------
55
56    --  The Task_Info pragma:
57
58    --    pragma Task_Info (EXPRESSION);
59
60    --  allows the specification on a task by task basis of a value of type
61    --  System.Task_Info.Task_Info_Type to be passed to a task when it is
62    --  created. The specification of this type, and the effect on the task
63    --  that is created is target dependent.
64
65    --  The Task_Info pragma appears within a task definition (compare the
66    --  definition and implementation of pragma Priority). If no such pragma
67    --  appears, then the value Task_Info_Unspecified is passed. If a pragma
68    --  is present, then it supplies an alternative value. If the argument of
69    --  the pragma is a discriminant reference, then the value can be set on
70    --  a task by task basis by supplying the appropriate discriminant value.
71
72    --  Note that this means that the type used for Task_Info_Type must be
73    --  suitable for use as a discriminant (i.e. a scalar or access type).
74
75    ------------------
76    -- Declarations --
77    ------------------
78
79    type Scope_Type is
80      (Process_Scope,
81       --  Contend only with threads in same process
82
83       System_Scope,
84       --  Contend with all threads on same CPU
85
86       Default_Scope);
87
88    type Thread_Attributes is record
89       Bind_To_Cpu_Number : Integer;
90       --   -1: Do nothing
91       --    0: Unbind
92       --  1-N: Bind all unbound threads to this CPU
93
94       Contention_Scope   : Scope_Type;
95    end record;
96
97    type Task_Info_Type is access all Thread_Attributes;
98    --  Type used for passing information to task create call, using the
99    --  Task_Info pragma. This type may be specialized for individual
100    --  implementations, but it must be a type that can be used as a
101    --  discriminant (i.e. a scalar or access type).
102
103    Unspecified_Thread_Attribute : aliased Thread_Attributes :=
104      Thread_Attributes'(-1, Default_Scope);
105
106    Unspecified_Task_Info : constant Task_Info_Type :=
107      Unspecified_Thread_Attribute'Access;
108    --  Value passed to task in the absence of a Task_Info pragma
109    --  Don't call new here because the tasking run time has not been
110    --  elaborated yet, so calling Task_Lock is unsafe.
111
112 end System.Task_Info;