summaryrefslogtreecommitdiff
path: root/gcc/ada/s-tassta.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-13 10:35:41 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-13 10:35:41 +0000
commita75dc8854e4a9cc5ae3e4456adf4d14d404bfbb2 (patch)
treebed8b7d025a1c50e17125549d28ffebc431f7ef7 /gcc/ada/s-tassta.adb
parent9f30d4b26890354e87b4e449b698c2936b5475da (diff)
downloadgcc-a75dc8854e4a9cc5ae3e4456adf4d14d404bfbb2.tar.gz
* s-tassta.adb (Create_Task): Take into account tasks created by
foreign threads. Code clean up: use constants instead of hard coded values. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130865 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-tassta.adb')
-rw-r--r--gcc/ada/s-tassta.adb17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb
index ceea9352b3e..9c574f06dc8 100644
--- a/gcc/ada/s-tassta.adb
+++ b/gcc/ada/s-tassta.adb
@@ -614,7 +614,18 @@ package body System.Tasking.Stages is
(Storage_Error'Identity, "Failed to initialize task");
end if;
- T.Master_of_Task := Master;
+ if Master = Foreign_Task_Level + 2 then
+
+ -- This should not happen, except when a foreign task creates non
+ -- library-level Ada tasks. In this case, we pretend the master is
+ -- a regular library level task, otherwise the run-time will get
+ -- confused when waiting for these tasks to terminate.
+
+ T.Master_of_Task := Library_Task_Level;
+ else
+ T.Master_of_Task := Master;
+ end if;
+
T.Master_Within := T.Master_of_Task + 1;
for L in T.Entry_Calls'Range loop
@@ -1276,7 +1287,7 @@ package body System.Tasking.Stages is
-- Check if the current task is an independent task If so, decrement
-- the Independent_Task_Count value.
- if Master_of_Task = 2 then
+ if Master_of_Task = Independent_Task_Level then
if Single_Lock then
Utilities.Independent_Task_Count :=
Utilities.Independent_Task_Count - 1;
@@ -1772,7 +1783,7 @@ package body System.Tasking.Stages is
if (T.Common.Parent /= null
and then T.Common.Parent.Common.Parent /= null)
- or else T.Master_of_Task > 3
+ or else T.Master_of_Task > Library_Task_Level
then
Initialization.Task_Lock (Self_ID);