aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2009-04-24 10:02:16 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-24 12:02:16 +0200
commit144c034d552e5eab050b1b2a1844059db3358ed5 (patch)
treebf2bcc1c17f541d56c8b6ded585eb2574f3f9025
parente0697153ed8242c02e71b878b12a12a8e46f5aa0 (diff)
downloadgcc-144c034d552e5eab050b1b2a1844059db3358ed5.zip
gcc-144c034d552e5eab050b1b2a1844059db3358ed5.tar.gz
gcc-144c034d552e5eab050b1b2a1844059db3358ed5.tar.bz2
s-tassta.adb (Create_Task): Fix violation of locking rule.
2009-04-24 Arnaud Charlet <charlet@adacore.com> * s-tassta.adb (Create_Task): Fix violation of locking rule. From-SVN: r146685
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/s-tassta.adb10
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ae01f1c..e6b69b3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2009-04-24 Arnaud Charlet <charlet@adacore.com>
+
+ * s-tassta.adb (Create_Task): Fix violation of locking rule.
+
2009-04-24 Emmanuel Briot <briot@adacore.com>
* prj.adb, prj.ads, prj-nmsc.adb, prj-env.adb (Language_Index): renamed
diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb
index 62aee27..76e3740 100644
--- a/gcc/ada/s-tassta.adb
+++ b/gcc/ada/s-tassta.adb
@@ -621,14 +621,18 @@ package body System.Tasking.Stages is
T.Common.Task_Image_Len := Len;
end if;
+ Unlock (Self_ID);
+ Unlock_RTS;
+
+ -- Note: we should not call 'new' while holding locks since new
+ -- may use locks (e.g. RTS_Lock under Windows) itself and cause a
+ -- deadlock.
+
if Build_Entry_Names then
T.Entry_Names :=
new Entry_Names_Array (1 .. Entry_Index (Num_Entries));
end if;
- Unlock (Self_ID);
- Unlock_RTS;
-
-- Create TSD as early as possible in the creation of a task, since it
-- may be used by the operation of Ada code within the task.