summaryrefslogtreecommitdiff
path: root/gcc/ada/s-interr-sigaction.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/s-interr-sigaction.adb')
-rw-r--r--gcc/ada/s-interr-sigaction.adb43
1 files changed, 22 insertions, 21 deletions
diff --git a/gcc/ada/s-interr-sigaction.adb b/gcc/ada/s-interr-sigaction.adb
index 7dff527ae80..dc0fffd048a 100644
--- a/gcc/ada/s-interr-sigaction.adb
+++ b/gcc/ada/s-interr-sigaction.adb
@@ -105,10 +105,9 @@ package body System.Interrupts is
type Server_Task_Access is access Server_Task;
- Attached_Interrupts : array (Interrupt_ID) of Boolean;
- Handlers : array (Interrupt_ID) of Task_Id;
- Descriptors : array (Interrupt_ID) of Handler_Desc;
- Interrupt_Count : array (Interrupt_ID) of Integer := (others => 0);
+ Handlers : array (Interrupt_ID) of Task_Id;
+ Descriptors : array (Interrupt_ID) of Handler_Desc;
+ Interrupt_Count : array (Interrupt_ID) of Integer := (others => 0);
pragma Volatile_Components (Interrupt_Count);
@@ -149,8 +148,13 @@ package body System.Interrupts is
function TISR is new Unchecked_Conversion (Handler_Ptr, isr_address);
+ --------------------
+ -- Signal_Handler --
+ --------------------
+
procedure Signal_Handler (Sig : Interrupt_ID) is
Handler : Task_Id renames Handlers (Sig);
+
begin
if Intr_Attach_Reset and then
intr_attach (int (Sig), TISR (Signal_Handler'Access)) = FUNC_ERR
@@ -386,9 +390,8 @@ package body System.Interrupts is
if New_Handler = null then
- -- The null handler means we are detaching the handler.
+ -- The null handler means we are detaching the handler
- Attached_Interrupts (Interrupt) := False;
Descriptors (Interrupt) :=
(Kind => Unknown, T => null, E => 0, H => null, Static => False);
@@ -396,7 +399,6 @@ package body System.Interrupts is
Descriptors (Interrupt).Kind := Protected_Procedure;
Descriptors (Interrupt).H := New_Handler;
Descriptors (Interrupt).Static := Static;
- Attached_Interrupts (Interrupt) := True;
end if;
end Attach_Handler;
@@ -408,7 +410,8 @@ package body System.Interrupts is
(Old_Handler : out Parameterless_Handler;
New_Handler : Parameterless_Handler;
Interrupt : Interrupt_ID;
- Static : Boolean := False) is
+ Static : Boolean := False)
+ is
begin
if Is_Reserved (Interrupt) then
raise Program_Error;
@@ -433,7 +436,8 @@ package body System.Interrupts is
procedure Detach_Handler
(Interrupt : Interrupt_ID;
- Static : Boolean := False) is
+ Static : Boolean := False)
+ is
begin
if Is_Reserved (Interrupt) then
raise Program_Error;
@@ -449,7 +453,6 @@ package body System.Interrupts is
"Trying to detach a static Interrupt Handler");
end if;
- Attached_Interrupts (Interrupt) := False;
Descriptors (Interrupt) :=
(Kind => Unknown, T => null, E => 0, H => null, Static => False);
@@ -537,7 +540,7 @@ package body System.Interrupts is
Int_Ref : System.Address)
is
Interrupt : constant Interrupt_ID :=
- Interrupt_ID (Storage_Elements.To_Integer (Int_Ref));
+ Interrupt_ID (Storage_Elements.To_Integer (Int_Ref));
New_Task : Server_Task_Access;
@@ -572,8 +575,6 @@ package body System.Interrupts is
-- make by the task before it terminates.
T.Interrupt_Entry := True;
-
- Attached_Interrupts (Interrupt) := True;
end Bind_Interrupt_To_Entry;
------------------------------
@@ -582,14 +583,14 @@ package body System.Interrupts is
procedure Detach_Interrupt_Entries (T : Task_Id) is
begin
- for I in Interrupt_ID loop
- if not Is_Reserved (I) then
- if Descriptors (I).Kind = Task_Entry and then
- Descriptors (I).T = T then
- Attached_Interrupts (I) := False;
- Descriptors (I).Kind := Unknown;
-
- if intr_attach (int (I), null) = FUNC_ERR then
+ for J in Interrupt_ID loop
+ if not Is_Reserved (J) then
+ if Descriptors (J).Kind = Task_Entry
+ and then Descriptors (J).T = T
+ then
+ Descriptors (J).Kind := Unknown;
+
+ if intr_attach (int (J), null) = FUNC_ERR then
raise Program_Error;
end if;
end if;