diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-09-18 15:40:54 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-09-18 15:40:54 +0200 |
commit | 658cea5b3e38f28dcdfe3322998089e2c19bad07 (patch) | |
tree | 60698fbf303f15de24e86c6bb64c0aef1c577c52 /gcc/ada/s-taprop-linux.adb | |
parent | 2b5bcdeec811568080fbf35bf5927d6fa15b8e05 (diff) | |
download | gcc-658cea5b3e38f28dcdfe3322998089e2c19bad07.zip gcc-658cea5b3e38f28dcdfe3322998089e2c19bad07.tar.gz gcc-658cea5b3e38f28dcdfe3322998089e2c19bad07.tar.bz2 |
[multiple changes]
2009-09-18 Arnaud Charlet <charlet@adacore.com>
* s-taprop-tru64.adb, s-taprop-linux.adb, s-taprop-solaris.adb,
s-taprop-irix.adb, s-taprop-posix.adb (Abort_Task): Do nothing if no
signal handler is installed.
* s-tassta.adb (Finalize_Global_Tasks): Do not wait for independent
tasks if Abort_Task_Interrupt cannot be used.
2009-09-18 Vincent Celier <celier@adacore.com>
* prj-tree.ads: Minor comment update
From-SVN: r151841
Diffstat (limited to 'gcc/ada/s-taprop-linux.adb')
-rw-r--r-- | gcc/ada/s-taprop-linux.adb | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb index 6d197f7..46b10a3 100644 --- a/gcc/ada/s-taprop-linux.adb +++ b/gcc/ada/s-taprop-linux.adb @@ -68,9 +68,6 @@ package body System.Task_Primitives.Operations is use System.OS_Primitives; use System.Task_Info; - Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0; - -- Whether to use an alternate signal stack for stack overflows - ---------------- -- Local Data -- ---------------- @@ -112,6 +109,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 -- -------------------- @@ -172,6 +175,11 @@ package body System.Task_Primitives.Operations is Old_Set : aliased sigset_t; begin + -- 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; end if; @@ -916,11 +924,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; ---------------- @@ -1264,8 +1274,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 @@ -1282,6 +1290,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; |