summaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-mingw.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-04 13:46:35 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-04 13:46:35 +0000
commit09ba36d90617bf2eba9338bf7e74376adb7e541f (patch)
tree5d844c02464716a053a759f5d52fffb97421aff9 /gcc/ada/s-taprop-mingw.adb
parentcc0baf29276908bb403f7c7e55df09cd13b37839 (diff)
downloadgcc-09ba36d90617bf2eba9338bf7e74376adb7e541f.tar.gz
2010-10-04 Arnaud Charlet <charlet@adacore.com>
* s-taprop-mingw.adb (Create_Task): Initialize Thread_Id field to 0. 2010-10-04 Robert Dewar <dewar@adacore.com> * exp_cg.adb: Minor code reorganization Minor reformatting. * exp_ch5.adb, prj-nmsc.adb: Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-taprop-mingw.adb')
-rw-r--r--gcc/ada/s-taprop-mingw.adb19
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ada/s-taprop-mingw.adb b/gcc/ada/s-taprop-mingw.adb
index a3b19ab5c5d..2339e528cdd 100644
--- a/gcc/ada/s-taprop-mingw.adb
+++ b/gcc/ada/s-taprop-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -918,6 +918,15 @@ package body System.Task_Primitives.Operations is
T.Common.LL.Thread := hTask;
+ -- Note: it would be useful to initialize Thread_Id right away to avoid
+ -- a race condition in gdb where Thread_ID may not have the right value
+ -- yet, but GetThreadId is a Vista specific API, not available under XP:
+ -- T.Common.LL.Thread_Id := GetThreadId (hTask); so instead we set the
+ -- field to 0 to avoid having a random value. Thread_Id is initialized
+ -- in Enter_Task anyway.
+
+ T.Common.LL.Thread_Id := 0;
+
-- Step 3: set its priority (child has inherited priority from parent)
Set_Priority (T, Priority);
@@ -927,8 +936,8 @@ package body System.Task_Primitives.Operations is
or else Get_Policy (Priority) = 'F'
then
-- Here we need Annex D semantics so we disable the NT priority
- -- boost. A priority boost is temporarily given by the system to a
- -- thread when it is taken out of a wait state.
+ -- boost. A priority boost is temporarily given by the system to
+ -- a thread when it is taken out of a wait state.
SetThreadPriorityBoost (hTask, DisablePriorityBoost => Win32.TRUE);
end if;
@@ -942,7 +951,7 @@ package body System.Task_Primitives.Operations is
end if;
end if;
- -- Step 5: Now, start it for good:
+ -- Step 5: Now, start it for good
Result := ResumeThread (hTask);
pragma Assert (Result = 1);
@@ -1122,6 +1131,7 @@ package body System.Task_Primitives.Operations is
procedure Finalize (S : in out Suspension_Object) is
Result : BOOL;
+
begin
-- Destroy internal mutex
@@ -1200,6 +1210,7 @@ package body System.Task_Primitives.Operations is
procedure Suspend_Until_True (S : in out Suspension_Object) is
Result : DWORD;
Result_Bool : BOOL;
+
begin
SSL.Abort_Defer.all;