1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS --
9 -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
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, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
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. --
29 -- GNARL was developed by the GNARL team at Florida State University. --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
32 ------------------------------------------------------------------------------
34 package System
.Interrupt_Management
.Operations
is
36 procedure Thread_Block_Interrupt
(Interrupt
: Interrupt_ID
);
37 pragma Inline
(Thread_Block_Interrupt
);
38 -- Mask the calling thread for the interrupt
40 procedure Thread_Unblock_Interrupt
(Interrupt
: Interrupt_ID
);
41 pragma Inline
(Thread_Unblock_Interrupt
);
42 -- Unmask the calling thread for the interrupt
44 procedure Set_Interrupt_Mask
(Mask
: access Interrupt_Mask
);
45 -- Set the interrupt mask of the calling thread
47 procedure Set_Interrupt_Mask
48 (Mask
: access Interrupt_Mask
;
49 OMask
: access Interrupt_Mask
);
50 pragma Inline
(Set_Interrupt_Mask
);
51 -- Set the interrupt mask of the calling thread while returning the
54 procedure Get_Interrupt_Mask
(Mask
: access Interrupt_Mask
);
55 pragma Inline
(Get_Interrupt_Mask
);
56 -- Get the interrupt mask of the calling thread
58 function Interrupt_Wait
(Mask
: access Interrupt_Mask
) return Interrupt_ID
;
59 pragma Inline
(Interrupt_Wait
);
60 -- Wait for the interrupts specified in Mask and return
61 -- the interrupt received. Return 0 upon error.
63 procedure Install_Default_Action
(Interrupt
: Interrupt_ID
);
64 pragma Inline
(Install_Default_Action
);
65 -- Set the sigaction of the Interrupt to default (SIG_DFL)
67 procedure Install_Ignore_Action
(Interrupt
: Interrupt_ID
);
68 pragma Inline
(Install_Ignore_Action
);
69 -- Set the sigaction of the Interrupt to ignore (SIG_IGN)
71 procedure Fill_Interrupt_Mask
(Mask
: access Interrupt_Mask
);
72 pragma Inline
(Fill_Interrupt_Mask
);
73 -- Get a Interrupt_Mask with all the interrupt masked
75 procedure Empty_Interrupt_Mask
(Mask
: access Interrupt_Mask
);
76 pragma Inline
(Empty_Interrupt_Mask
);
77 -- Get a Interrupt_Mask with all the interrupt unmasked
79 procedure Add_To_Interrupt_Mask
80 (Mask
: access Interrupt_Mask
;
81 Interrupt
: Interrupt_ID
);
82 pragma Inline
(Add_To_Interrupt_Mask
);
83 -- Mask the given interrupt in the Interrupt_Mask
85 procedure Delete_From_Interrupt_Mask
86 (Mask
: access Interrupt_Mask
;
87 Interrupt
: Interrupt_ID
);
88 pragma Inline
(Delete_From_Interrupt_Mask
);
89 -- Unmask the given interrupt in the Interrupt_Mask
92 (Mask
: access Interrupt_Mask
;
93 Interrupt
: Interrupt_ID
) return Boolean;
94 pragma Inline
(Is_Member
);
95 -- See if a given interrupt is masked in the Interrupt_Mask
97 procedure Copy_Interrupt_Mask
(X
: out Interrupt_Mask
; Y
: Interrupt_Mask
);
98 pragma Inline
(Copy_Interrupt_Mask
);
99 -- Assignment needed for limited private type Interrupt_Mask
101 procedure Interrupt_Self_Process
(Interrupt
: Interrupt_ID
);
102 pragma Inline
(Interrupt_Self_Process
);
103 -- Raise an Interrupt process-level
105 procedure Setup_Interrupt_Mask
;
106 -- Mask Environment task for all signals
107 -- This function should be called by the elaboration of System.Interrupt
108 -- to set up proper signal masking in all tasks.
110 -- The following objects serve as constants, but are initialized in the
111 -- body to aid portability. These should be in System.Interrupt_Management
112 -- but since Interrupt_Mask is private type we cannot have them declared
115 -- Why not make these deferred constants that are initialized using
116 -- function calls in the private part???
118 Environment_Mask
: aliased Interrupt_Mask
;
119 -- This mask represents the mask of Environment task when this package is
120 -- being elaborated, except the signals being forced to be unmasked by RTS
121 -- (items in Keep_Unmasked)
123 All_Tasks_Mask
: aliased Interrupt_Mask
;
124 -- This is the mask of all tasks created in RTS. Only one task in RTS
125 -- is responsible for masking/unmasking signals (see s-interr.adb).
127 end System
.Interrupt_Management
.Operations
;