summaryrefslogtreecommitdiff
path: root/gcc/ada/s-tarest.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:28:13 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:28:13 +0000
commit2e70d70dab8bc2f09b71041dc9719a5fbed638ab (patch)
treeff0fc56323a0b3142eb004ad33e55efe4c4a9b4e /gcc/ada/s-tarest.adb
parent781d92c8873c51c988ccca82594906894fd0cd80 (diff)
downloadgcc-2e70d70dab8bc2f09b71041dc9719a5fbed638ab.tar.gz
2006-02-13 Jose Ruiz <ruiz@adacore.com>
* a-taster.adb (Current_Task_Fallback_Handler): Document why explicit protection against race conditions is not needed. (Set_Dependents_Fallback_Handler): Add mutual exclusive access to the fallback handler. (Set_Specific_Handler): Add mutual exclusive access to the specific handler. (Specific_Handler): Add mutual exclusive access for retrieving the specific handler. * s-tarest.adb (Task_Wrapper): Add mutual exclusive access to the fall back handler. * s-taskin.ads (Common_ATCB): Remove pragma Atomic for Fall_Back_Handler and Specific_Handler. * s-tassta.adb (Task_Wrapper): Add mutual exclusive access to the task termination handlers. Set two different owerflow depending on the maximal stack size. * s-solita.adb (Task_Termination_Handler_T): Document why explicit protection against race conditions is not needed when executing the task termination handler. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111022 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-tarest.adb')
-rw-r--r--gcc/ada/s-tarest.adb44
1 files changed, 32 insertions, 12 deletions
diff --git a/gcc/ada/s-tarest.adb b/gcc/ada/s-tarest.adb
index f0ac3b8de16..6c43d7ce962 100644
--- a/gcc/ada/s-tarest.adb
+++ b/gcc/ada/s-tarest.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2006, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -48,13 +48,6 @@ pragma Polling (Off);
with Ada.Exceptions;
-- used for Exception_Occurrence
-with System.Parameters;
--- used for Size_Type
--- Single_Lock
-
-with System.Task_Info;
--- used for Task_Info_Type
-
with System.Task_Primitives.Operations;
-- used for Enter_Task
-- Write_Lock
@@ -268,11 +261,38 @@ package body System.Tasking.Restricted.Stages is
-- neither task hierarchies (No_Task_Hierarchy) nor specific task
-- termination handlers (No_Specific_Termination_Handlers).
+ -- There is no need for explicit protection against race conditions
+ -- for Self_ID.Common.Fall_Back_Handler because this procedure can
+ -- only be executed by Self, and the Fall_Back_Handler can only be
+ -- modified by Self.
+
if Self_ID.Common.Fall_Back_Handler /= null then
- Self_ID.Common.Fall_Back_Handler.all (Cause, Self_ID, EO);
- elsif Self_ID.Common.Parent.Common.Fall_Back_Handler /= null then
- Self_ID.Common.Parent.Common.Fall_Back_Handler.all
- (Cause, Self_ID, EO);
+ Self_ID.Common.Fall_Back_Handler (Cause, Self_ID, EO);
+ else
+ declare
+ TH : Termination_Handler := null;
+
+ begin
+ if Single_Lock then
+ Lock_RTS;
+ end if;
+
+ Write_Lock (Self_ID.Common.Parent);
+
+ TH := Self_ID.Common.Parent.Common.Fall_Back_Handler;
+
+ Unlock (Self_ID.Common.Parent);
+
+ if Single_Lock then
+ Unlock_RTS;
+ end if;
+
+ -- Execute the task termination handler if we found it
+
+ if TH /= null then
+ TH.all (Cause, Self_ID, EO);
+ end if;
+ end;
end if;
Terminate_Task (Self_ID);