summaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-posix.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-21 05:20:21 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-21 05:20:21 +0000
commitaea72cce7e400a42c105d192fdff0a01d9634d43 (patch)
tree6a2dcbc13ba8e832ec200e3bbf79cdb2c6b68006 /gcc/ada/s-taprop-posix.adb
parent539a0502dc8dfe9e6440ac544f7baa370298a804 (diff)
downloadgcc-aea72cce7e400a42c105d192fdff0a01d9634d43.tar.gz
2009-09-21 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 151911 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@151912 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-taprop-posix.adb')
-rw-r--r--gcc/ada/s-taprop-posix.adb30
1 files changed, 18 insertions, 12 deletions
diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb
index ac147000b7a..db385c8c589 100644
--- a/gcc/ada/s-taprop-posix.adb
+++ b/gcc/ada/s-taprop-posix.adb
@@ -71,9 +71,6 @@ package body System.Task_Primitives.Operations is
use System.Parameters;
use System.OS_Primitives;
- Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0;
- -- Whether to use an alternate signal stack for stack overflows
-
----------------
-- Local Data --
----------------
@@ -117,6 +114,12 @@ package body System.Task_Primitives.Operations is
Foreign_Task_Elaborated : aliased Boolean := True;
-- Used to identified fake tasks (i.e., non-Ada Threads)
+ Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0;
+ -- Whether to use an alternate signal stack for stack overflows
+
+ Abort_Handler_Installed : Boolean := False;
+ -- True if a handler for the abort signal is installed
+
--------------------
-- Local Packages --
--------------------
@@ -198,8 +201,10 @@ package body System.Task_Primitives.Operations is
pragma Warnings (Off, Result);
begin
- -- It is not safe to raise an exception when using ZCX and the GCC
- -- exception handling mechanism.
+ -- It's not safe to raise an exception when using GCC ZCX mechanism.
+ -- Note that we still need to install a signal handler, since in some
+ -- cases (e.g. shutdown of the Server_Task in System.Interrupts) we
+ -- need to send the Abort signal to a task.
if ZCX_By_Default and then GCC_ZCX_Support then
return;
@@ -1066,11 +1071,13 @@ package body System.Task_Primitives.Operations is
procedure Abort_Task (T : Task_Id) is
Result : Interfaces.C.int;
begin
- Result :=
- pthread_kill
- (T.Common.LL.Thread,
- Signal (System.Interrupt_Management.Abort_Task_Interrupt));
- pragma Assert (Result = 0);
+ if Abort_Handler_Installed then
+ Result :=
+ pthread_kill
+ (T.Common.LL.Thread,
+ Signal (System.Interrupt_Management.Abort_Task_Interrupt));
+ pragma Assert (Result = 0);
+ end if;
end Abort_Task;
----------------
@@ -1447,8 +1454,6 @@ package body System.Task_Primitives.Operations is
Enter_Task (Environment_Task);
- -- Install the abort-signal handler
-
if State
(System.Interrupt_Management.Abort_Task_Interrupt) /= Default
then
@@ -1465,6 +1470,7 @@ package body System.Task_Primitives.Operations is
act'Unchecked_Access,
old_act'Unchecked_Access);
pragma Assert (Result = 0);
+ Abort_Handler_Installed := True;
end if;
end Initialize;