diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 08:44:02 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 08:44:02 +0000 |
commit | 89ce0207a2cbb8db3490005868cca90b94dc6e6e (patch) | |
tree | c0fcdfb991e1fa07e98bedeff17e18a4ec61598a /gcc/ada/s-taprop-mingw.adb | |
parent | 6925ea9f399f9d12d3de44754eec7d5af40e620c (diff) | |
download | gcc-89ce0207a2cbb8db3490005868cca90b94dc6e6e.tar.gz |
2007-08-14 Pascal Obry <obry@adacore.com>
* s-osinte-mingw.ads: Add support for Ada.Execution_Time on Windows.
(SYSTEM_INFO): New record.
(SetThreadIdealProcessor): New imported routine needed for supporting
task_info pragma on Windows.
* s-taprop-mingw.adb (Enter_Task): Check if CPU number given in task
info can be applied to the current host.
(Create_Task): Set the ideal processor if information is present.
* s-tasinf-mingw.adb, s-tasinf-mingw.ads,
a-exetim-mingw.adb, a-exetim-mingw.ads: New files.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127434 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-taprop-mingw.adb')
-rw-r--r-- | gcc/ada/s-taprop-mingw.adb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ada/s-taprop-mingw.adb b/gcc/ada/s-taprop-mingw.adb index 1c979355b20..603e2430378 100644 --- a/gcc/ada/s-taprop-mingw.adb +++ b/gcc/ada/s-taprop-mingw.adb @@ -80,6 +80,7 @@ package body System.Task_Primitives.Operations is use System.OS_Interface; use System.Parameters; use System.OS_Primitives; + use System.Task_Info; pragma Link_With ("-Xlinker --stack=0x200000,0x1000"); -- Change the default stack size (2 MB) for tasking programs on Windows. @@ -786,6 +787,13 @@ package body System.Task_Primitives.Operations is Specific.Set (Self_ID); Init_Float; + if Self_ID.Common.Task_Info /= null + and then + Self_ID.Common.Task_Info.CPU >= CPU_Number (Number_Of_Processors) + then + raise Invalid_CPU_Number; + end if; + Self_ID.Common.LL.Thread_Id := GetCurrentThreadId; Lock_RTS; @@ -925,7 +933,16 @@ package body System.Task_Primitives.Operations is SetThreadPriorityBoost (hTask, DisablePriorityBoost => True); end if; - -- Step 4: Now, start it for good: + -- Step 4: Handle Task_Info + + if T.Common.Task_Info /= null then + if T.Common.Task_Info.CPU /= Task_Info.Any_CPU then + Result := SetThreadIdealProcessor (hTask, T.Common.Task_Info.CPU); + pragma Assert (Result = 1); + end if; + end if; + + -- Step 5: Now, start it for good: Result := ResumeThread (hTask); pragma Assert (Result = 1); @@ -1275,4 +1292,23 @@ package body System.Task_Primitives.Operations is end if; end Resume_Task; + -------------------- + -- Stop_All_Tasks -- + -------------------- + + procedure Stop_All_Tasks is + begin + null; + end Stop_All_Tasks; + + ------------------- + -- Continue_Task -- + ------------------- + + function Continue_Task (T : ST.Task_Id) return Boolean is + pragma Unreferenced (T); + begin + return False; + end Continue_Task; + end System.Task_Primitives.Operations; |