OSDN Git Service

* gfortran.dg/ishft.f90: Remove kind suffix from BOZ constant
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-intman.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
4 --                                                                          --
5 --            S Y S T E M . I N T E R R U P T _ M A N A G E M E N T         --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --          Copyright (C) 1992-2003 Free Software Foundation, Inc.          --
10 --                                                                          --
11 -- GNARL 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 2,  or (at your option) any later ver- --
14 -- sion. GNARL 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.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
19 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNARL was developed by the GNARL team at Florida State University.       --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This package encapsulates and centralizes information about all
35 --  uses of interrupts (or signals), including the target-dependent
36 --  mapping of interrupts (or signals) to exceptions.
37
38 --  Unlike the original design, System.Interrupt_Management can only
39 --  be used for tasking systems.
40
41 --  PLEASE DO NOT remove the Elaborate_Body pragma from this package.
42 --  Elaboration of this package should happen early, as most other
43 --  initializations depend on it. Forcing immediate elaboration of
44 --  the body also helps to enforce the design assumption that this
45 --  is a second-level package, just one level above System.OS_Interface
46 --  with no cross-dependencies.
47
48 --  PLEASE DO NOT put any subprogram declarations with arguments of
49 --  type Interrupt_ID into the visible part of this package. The type
50 --  Interrupt_ID is used to derive the type in Ada.Interrupts, and
51 --  adding more operations to that type would be illegal according
52 --  to the Ada Reference Manual. This is the reason why the signals
53 --  sets are implemeneted using visible arrays rather than functions.
54
55 with System.OS_Interface;
56 --  used for sigset_t
57
58 with Interfaces.C;
59 --  used for int
60
61 package System.Interrupt_Management is
62
63    pragma Elaborate_Body;
64
65    type Interrupt_Mask is limited private;
66
67    type Interrupt_ID is new Interfaces.C.int
68      range 0 .. System.OS_Interface.Max_Interrupt;
69
70    type Interrupt_Set is array (Interrupt_ID) of Boolean;
71
72    --  The following objects serve as constants, but are initialized
73    --  in the body to aid portability.  This permits us to use more
74    --  portable names for interrupts, where distinct names may map to
75    --  the same interrupt ID value.
76    --
77    --  For example, suppose SIGRARE is a signal that is not defined on
78    --  all systems, but is always reserved when it is defined. If we
79    --  have the convention that ID zero is not used for any "real"
80    --  signals, and SIGRARE = 0 when SIGRARE is not one of the locally
81    --  supported signals, we can write
82    --     Reserved (SIGRARE) := true;
83    --  and the initialization code will be portable.
84
85    Abort_Task_Interrupt : Interrupt_ID;
86    --  The interrupt that is used to implement task abortion if
87    --  an interrupt is used for that purpose. This is one of the
88    --  reserved interrupts.
89
90    Keep_Unmasked : Interrupt_Set := (others => False);
91    --  Keep_Unmasked (I) is true iff the interrupt I is one that must
92    --  that must be kept unmasked at all times, except (perhaps) for
93    --  short critical sections. This includes interrupts that are
94    --  mapped to exceptions (see System.Interrupt_Exceptions.Is_Exception),
95    --  but may also include interrupts (e.g. timer) that need to be kept
96    --  unmasked for other reasons. Where interrupts are implemented as
97    --  OS signals, and signal masking is per-task, the interrupt should
98    --  be unmasked in ALL TASKS.
99
100    Reserve : Interrupt_Set := (others => False);
101    --  Reserve (I) is true iff the interrupt I is one that cannot be
102    --  permitted to be attached to a user handler. The possible reasons
103    --  are many. For example, it may be mapped to an exception used to
104    --  implement task abortion, or used to implement time delays.
105
106    procedure Initialize_Interrupts;
107    --  On systems where there is no signal inheritance between tasks (e.g
108    --  VxWorks, GNU/LinuxThreads), this procedure is used to initialize
109    --  interrupts handling in each task. Otherwise this function should
110    --  only be called by initialize in this package body.
111
112 private
113    type Interrupt_Mask is new System.OS_Interface.sigset_t;
114    --  In some implementation Interrupt_Mask can be represented
115    --  as a linked list.
116
117 end System.Interrupt_Management;