s-taprop-posix.adb, [...] (Create_Task): Remove task adjustment code.

2006-02-13  Pascal Obry  <obry@adacore.com>

	* s-taprop-posix.adb, s-taprop-vxworks.adb, s-taprop-tru64.adb, 
	s-taprop-lynxos.adb, s-taprop-irix.adb, s-taprop-hpux-dce.adb, 
	s-taprop-linux.adb, s-taprop-solaris.adb,
	s-taprop-vms.adb (Create_Task): Remove task adjustment code. This
	adjustement is already done when calling this routine.

From-SVN: r111026
This commit is contained in:
Pascal Obry 2006-02-15 10:29:59 +01:00 committed by Arnaud Charlet
parent 1dd5ad55eb
commit 57d8e34e53
9 changed files with 28 additions and 163 deletions

View file

@ -779,24 +779,13 @@ package body System.Task_Primitives.Operations is
Priority : System.Any_Priority;
Succeeded : out Boolean)
is
Attributes : aliased pthread_attr_t;
Adjusted_Stack_Size : Interfaces.C.size_t;
Result : Interfaces.C.int;
Attributes : aliased pthread_attr_t;
Result : Interfaces.C.int;
function Thread_Body_Access is new
Unchecked_Conversion (System.Address, Thread_Body);
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
Result := pthread_attr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
@ -806,7 +795,7 @@ package body System.Task_Primitives.Operations is
end if;
Result := pthread_attr_setstacksize
(Attributes'Access, Adjusted_Stack_Size);
(Attributes'Access, Interfaces.C.size_t (Stack_Size));
pragma Assert (Result = 0);
-- Since the initial signal mask of a thread is inherited from the

View file

@ -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- --
@ -60,19 +60,6 @@ with System.OS_Primitives;
with System.IO;
-- used for Put_Line
with System.Parameters;
-- used for Size_Type
with System.Program_Info;
-- used for Default_Task_Stack
-- Default_Time_Slice
-- Stack_Guard_Pages
-- Pthread_Sched_Signal
-- Pthread_Arena_Size
with System.OS_Interface;
-- used for various type, constant, and operations
with Unchecked_Conversion;
with Unchecked_Deallocation;
@ -763,10 +750,9 @@ package body System.Task_Primitives.Operations is
is
use System.Task_Info;
Attributes : aliased pthread_attr_t;
Sched_Param : aliased struct_sched_param;
Adjusted_Stack_Size : Interfaces.C.size_t;
Result : Interfaces.C.int;
Attributes : aliased pthread_attr_t;
Sched_Param : aliased struct_sched_param;
Result : Interfaces.C.int;
function Thread_Body_Access is new
Unchecked_Conversion (System.Address, Thread_Body);
@ -779,18 +765,6 @@ package body System.Task_Primitives.Operations is
(System.Task_Info.Thread_Scheduling_Policy, Interfaces.C.int);
begin
if Stack_Size = System.Parameters.Unspecified_Size then
Adjusted_Stack_Size :=
Interfaces.C.size_t (System.Program_Info.Default_Task_Stack);
elsif Stack_Size < Size_Type (Minimum_Stack_Size) then
Adjusted_Stack_Size :=
Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
Result := pthread_attr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
@ -804,7 +778,7 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0);
Result := pthread_attr_setstacksize
(Attributes'Access, Adjusted_Stack_Size);
(Attributes'Access, Interfaces.C.size_t (Stack_Size));
pragma Assert (Result = 0);
if T.Common.Task_Info /= null then

View file

@ -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- --
@ -44,9 +44,6 @@ with Interfaces.C;
-- used for int
-- size_t
with System.Parameters;
-- used for Size_Type
with System.Tasking.Debug;
-- used for Known_Tasks
@ -745,22 +742,10 @@ package body System.Task_Primitives.Operations is
Priority : System.Any_Priority;
Succeeded : out Boolean)
is
Adjusted_Stack_Size : Interfaces.C.size_t;
Attributes : aliased pthread_attr_t;
Result : Interfaces.C.int;
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
Result := pthread_attr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
@ -771,7 +756,7 @@ package body System.Task_Primitives.Operations is
Result :=
pthread_attr_setstacksize
(Attributes'Access, Adjusted_Stack_Size);
(Attributes'Access, Interfaces.C.size_t (Stack_Size));
pragma Assert (Result = 0);
Result :=

View file

@ -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- --
@ -59,9 +59,6 @@ with Interfaces.C;
-- used for int
-- size_t
with System.Parameters;
-- used for Size_Type
with Unchecked_Deallocation;
package body System.Task_Primitives.Operations is
@ -869,15 +866,7 @@ package body System.Task_Primitives.Operations is
use System.Task_Info;
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
if Stack_Base_Available then

View file

@ -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- --
@ -64,9 +64,6 @@ with Interfaces.C;
-- used for int
-- size_t
with System.Parameters;
-- used for Size_Type
with Unchecked_Conversion;
with Unchecked_Deallocation;
@ -892,15 +889,7 @@ package body System.Task_Primitives.Operations is
use System.Task_Info;
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
if Stack_Base_Available then
-- If Stack Checking is supported then allocate 2 additional pages:

View file

@ -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- --
@ -61,9 +61,6 @@ with Interfaces.C;
-- used for int
-- size_t
with System.Parameters;
-- used for Size_Type
with System.Task_Info;
-- to initialize Task_Info for a C thread, in function Self
@ -981,11 +978,11 @@ package body System.Task_Primitives.Operations is
is
pragma Unreferenced (Priority);
Result : Interfaces.C.int;
Result : Interfaces.C.int;
Adjusted_Stack_Size : Interfaces.C.size_t;
Opts : Interfaces.C.int := THR_DETACHED;
Opts : Interfaces.C.int := THR_DETACHED;
Page_Size : constant System.Parameters.Size_Type := 4096;
Page_Size : constant System.Parameters.Size_Type := 4096;
-- This constant is for reserving extra space at the
-- end of the stack, which can be used by the stack
-- checking as guard page. The idea is that we need
@ -995,18 +992,7 @@ package body System.Task_Primitives.Operations is
use System.Task_Info;
begin
if Stack_Size = System.Parameters.Unspecified_Size then
Adjusted_Stack_Size :=
Interfaces.C.size_t (Default_Stack_Size + Page_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size :=
Interfaces.C.size_t (Minimum_Stack_Size + Page_Size);
else
Adjusted_Stack_Size :=
Interfaces.C.size_t (Stack_Size + Page_Size);
end if;
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size + Page_Size);
-- Since the initial signal mask of a thread is inherited from the
-- creator, and the Environment task has all its signals masked, we

View file

@ -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- --
@ -61,9 +61,6 @@ with Interfaces.C;
-- used for int
-- size_t
with System.Parameters;
-- used for Size_Type
with Unchecked_Deallocation;
package body System.Task_Primitives.Operations is
@ -780,20 +777,11 @@ package body System.Task_Primitives.Operations is
use System.Task_Info;
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
-- Account for the Yellow Zone (2 pages) and the guard page
-- right above. See Hide_Yellow_Zone for the rationale.
Adjusted_Stack_Size := Adjusted_Stack_Size + 3 * Get_Page_Size;
Adjusted_Stack_Size :=
Interfaces.C.size_t (Stack_Size) + 3 * Get_Page_Size;
Result := pthread_attr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);

View file

@ -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- --
@ -50,9 +50,6 @@ with Interfaces.C;
-- used for int
-- size_t
with System.Parameters;
-- used for Size_Type
with System.Soft_Links;
-- used for Get_Exc_Stack_Addr
@ -766,24 +763,13 @@ package body System.Task_Primitives.Operations is
Priority : System.Any_Priority;
Succeeded : out Boolean)
is
Attributes : aliased pthread_attr_t;
Adjusted_Stack_Size : Interfaces.C.size_t;
Result : Interfaces.C.int;
Attributes : aliased pthread_attr_t;
Result : Interfaces.C.int;
function Thread_Body_Access is new
Unchecked_Conversion (System.Address, Thread_Body);
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := Interfaces.C.size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := Interfaces.C.size_t (Stack_Size);
end if;
-- Since the initial signal mask of a thread is inherited from the
-- creator, we need to set our local signal mask mask all signals
-- during the creation operation, to make sure the new thread is
@ -802,7 +788,7 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0);
Result := pthread_attr_setstacksize
(Attributes'Access, Adjusted_Stack_Size);
(Attributes'Access, Interfaces.C.size_t (Stack_Size));
pragma Assert (Result = 0);
-- This call may be unnecessary, not sure. ???

View file

@ -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- --
@ -40,11 +40,6 @@ pragma Polling (Off);
-- Turn off polling, we do not want ATC polling to take place during
-- tasking operations. It causes infinite loops and other problems.
with System.Tasking;
-- used for Ada_Task_Control_Block
-- Task_Id
-- ATCB components and types
with System.Tasking.Debug;
-- used for Known_Tasks
@ -54,12 +49,6 @@ with System.Interrupt_Management;
-- Signal_ID
-- Initialize_Interrupts
with System.OS_Interface;
-- used for various type, constant, and operations
with System.Parameters;
-- used for Size_Type
with Interfaces.C;
with Unchecked_Conversion;
@ -866,16 +855,6 @@ package body System.Task_Primitives.Operations is
is
Adjusted_Stack_Size : size_t;
begin
if Stack_Size = Unspecified_Size then
Adjusted_Stack_Size := size_t (Default_Stack_Size);
elsif Stack_Size < Minimum_Stack_Size then
Adjusted_Stack_Size := size_t (Minimum_Stack_Size);
else
Adjusted_Stack_Size := size_t (Stack_Size);
end if;
-- Ask for four extra bytes of stack space so that the ATCB pointer can
-- be stored below the stack limit, plus extra space for the frame of
-- Task_Wrapper. This is so the user gets the amount of stack requested
@ -890,7 +869,7 @@ package body System.Task_Primitives.Operations is
-- ??? - we should come back and visit this so we can set the task name
-- to something appropriate.
Adjusted_Stack_Size := Adjusted_Stack_Size + 2048;
Adjusted_Stack_Size := size_t (Stack_Size) + 2048;
-- Since the initial signal mask of a thread is inherited from the
-- creator, and the Environment task has all its signals masked, we do