summaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-mingw.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:32:35 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:32:35 +0000
commite11441b606ae5dbf70d412effa06b036e897e5d3 (patch)
tree8736f59d63ae4441980493f8f378c8eab142e59d /gcc/ada/s-taprop-mingw.adb
parent165633c00f7ebfd93f2da18eda1f8686b3818de3 (diff)
downloadgcc-e11441b606ae5dbf70d412effa06b036e897e5d3.tar.gz
* s-parame-mingw.adb, s-parame-linux.adb,
s-parame-solaris.adb: Removed, replaced by s-parame.adb * s-parame-vxworks.ads: Fix typo. * s-parame-vxworks.adb: New file. * s-parame.adb: Version now used by all native platforms. (Default_Stack_Size): Use 2 megs for default stack size and use __gl_default_stack_size when available. (Minimum_Stack_Size): Use 12K. * s-taprop-mingw.adb: Set default stack size linker switch to 2megs. (Create_Task): Refine implementation taking advantage of the XP stack size support. On XP, we now create the thread using the flag STACK_SIZE_PARAM_IS_A_RESERVATION. * s-osinte-mingw.ads (Stack_Size_Param_Is_A_Reservation): New constant. * sysdep.c (__gnat_is_windows_xp): New routine, returns 1 on Windows XP and 0 on older Windows versions. * interfac-vms.ads: Removed, no longer used. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111034 138bc75d-0d04-0410-961f-82ee72b054a4
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 c18bdb3bfc9..7280f646dd2 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