aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-mingw.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/s-taprop-mingw.adb')
-rw-r--r--gcc/ada/s-taprop-mingw.adb54
1 files changed, 32 insertions, 22 deletions
diff --git a/gcc/ada/s-taprop-mingw.adb b/gcc/ada/s-taprop-mingw.adb
index c18bdb3..7280f64 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-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-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- --
@@ -53,12 +53,6 @@ with Interfaces.C;
with Interfaces.C.Strings;
-- used for Null_Ptr
-with System.OS_Interface;
--- used for various type, constant, and operations
-
-with System.Parameters;
--- used for Size_Type
-
with System.Task_Info;
-- used for Unspecified_Task_Info
@@ -74,10 +68,12 @@ package body System.Task_Primitives.Operations is
use System.Parameters;
use System.OS_Primitives;
- pragma Link_With ("-Xlinker --stack=0x800000,0x1000");
- -- Change the stack size (8 MB) for tasking programs on Windows. This
- -- permit to have more than 30 tasks running at the same time. Note that
+ pragma Link_With ("-Xlinker --stack=0x200000,0x1000");
+ -- Change the default stack size (2 MB) for tasking programs on Windows.
+ -- This allows about 1000 tasks running at the same time. Note that
-- we set the stack size for non tasking programs on System unit.
+ -- Also note that under Windows XP, we use a Windows XP extension to
+ -- specify the stack size on a per task basis, as done under other OSes.
----------------
-- Local Data --
@@ -818,12 +814,15 @@ package body System.Task_Primitives.Operations is
Priority : System.Any_Priority;
Succeeded : out Boolean)
is
- pragma Unreferenced (Stack_Size);
-
Initial_Stack_Size : constant := 1024;
- -- We set the initial stack size to 1024. On Windows there is no way to
- -- fix a task stack size. Only the initial stack size can be set, the
- -- operating system will raise the task stack size if needed.
+ -- We set the initial stack size to 1024. On Windows version prior to XP
+ -- there is no way to fix a task stack size. Only the initial stack size
+ -- can be set, the operating system will raise the task stack size if
+ -- needed.
+
+ function Is_Windows_XP return Integer;
+ pragma Import (C, Is_Windows_XP, "__gnat_is_windows_xp");
+ -- Returns 1 if running on Windows XP
hTask : HANDLE;
TaskId : aliased DWORD;
@@ -836,13 +835,24 @@ package body System.Task_Primitives.Operations is
Entry_Point := To_PTHREAD_START_ROUTINE (Wrapper);
- hTask := CreateThread
- (null,
- Initial_Stack_Size,
- Entry_Point,
- pTaskParameter,
- DWORD (Create_Suspended),
- TaskId'Unchecked_Access);
+ if Is_Windows_XP = 1 then
+ hTask := CreateThread
+ (null,
+ DWORD (Stack_Size),
+ Entry_Point,
+ pTaskParameter,
+ DWORD (Create_Suspended) or
+ DWORD (Stack_Size_Param_Is_A_Reservation),
+ TaskId'Unchecked_Access);
+ else
+ hTask := CreateThread
+ (null,
+ Initial_Stack_Size,
+ Entry_Point,
+ pTaskParameter,
+ DWORD (Create_Suspended),
+ TaskId'Unchecked_Access);
+ end if;
-- Step 1: Create the thread in blocked mode