OSDN Git Service

PR bootstrap/11932
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-taskin.ads
index 6c4404c..04a7657 100644 (file)
@@ -6,8 +6,7 @@
 --                                                                          --
 --                                  S p e c                                 --
 --                                                                          --
---                                                                          --
---          Copyright (C) 1992-2002, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2003, 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- --
@@ -27,8 +26,8 @@
 -- however invalidate  any other reasons why  the executable file  might be --
 -- covered by the  GNU Public License.                                      --
 --                                                                          --
--- GNARL was developed by the GNARL team at Florida State University. It is --
--- now maintained by Ada Core Technologies, Inc. (http://www.gnat.com).     --
+-- GNARL was developed by the GNARL team at Florida State University.       --
+-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -44,7 +43,7 @@ with System.Parameters;
 --  used for Size_Type
 
 with System.Task_Info;
---  used for Task_Info_Type, Task_Image_Type
+--  used for Task_Info_Type
 
 with System.Soft_Links;
 --  used for TSD
@@ -288,12 +287,12 @@ package System.Tasking is
    --  State >= Done, in which case it may or may not be still Onqueue.
 
    --  Please do not modify the order of the values, without checking
-   --  all uses of this type.  We rely on partial "monotonicity" of
+   --  all uses of this type. We rely on partial "monotonicity" of
    --  Entry_Call_Record.State to avoid locking when we access this
-   --  value for certain tests.  In particular:
+   --  value for certain tests. In particular:
 
    --  1)  Once State >= Done, we can rely that the call has been
-   --      completed.  If State >= Done, it will not
+   --      completed. If State >= Done, it will not
    --      change until the task does another entry call at this level.
 
    --  2)  Once State >= Was_Abortable, we can rely that the call has
@@ -372,7 +371,7 @@ package System.Tasking is
    --  Note: The order of the fields is important to implement efficiently
    --  tasking support under gdb.
    --  Currently gdb relies on the order of the State, Parent, Base_Priority,
-   --  Task_Image, Call and LL fields.
+   --  Task_Image, Task_Image_Len, Call and LL fields.
 
    ----------------------------------------------------------------------
    --  Common ATCB section                                             --
@@ -423,10 +422,13 @@ package System.Tasking is
       --  accepts an entry or when Created activates, at which points Self is
       --  suspended.
 
-      Task_Image : System.Task_Info.Task_Image_Type;
-      --  holds an access to string that provides a readable id for task,
+      Task_Image : String (1 .. 32);
+      --  Hold a string that provides a readable id for task,
       --  built from the variable of which it is a value or component.
 
+      Task_Image_Len : Natural;
+      --  Actual length of Task_Image.
+
       Call : Entry_Call_Link;
       --  The entry call that has been accepted by this task.
       --  Protection: Self.L. Self will modify this field
@@ -441,8 +443,8 @@ package System.Tasking is
       --  takes care of all of its synchronization.
 
       Task_Arg : System.Address;
-      --  The argument to task procedure. Currently unused; this will
-      --  provide a handle for discriminant information.
+      --  The argument to task procedure. Provide a handle for discriminant
+      --  information.
       --  Protection: Part of the synchronization between Self and
       --  Activator. Activator writes it, once, before Self starts
       --  executing. Thereafter, Self only reads it.
@@ -734,20 +736,20 @@ package System.Tasking is
    type Entry_Call_Array is array (ATC_Level_Index) of
      aliased Entry_Call_Record;
 
-   D_I_Count : constant := 2;
-   --  This constant may be adjusted, to allow more Address-sized
-   --  attributes to be stored directly in the task control block.
-
-   subtype Direct_Index is Integer range 0 .. D_I_Count - 1;
+   type Direct_Index is range 0 .. Parameters.Default_Attribute_Count;
+   subtype Direct_Index_Range is Direct_Index range 1 .. Direct_Index'Last;
    --  Attributes with indices in this range are stored directly in
-   --  the task control block.  Such attributes must be Address-sized.
+   --  the task control block. Such attributes must be Address-sized.
    --  Other attributes will be held in dynamically allocated records
    --  chained off of the task control block.
 
+   type Direct_Attribute_Element is mod Memory_Size;
+   pragma Atomic (Direct_Attribute_Element);
+
    type Direct_Attribute_Array is
-     array (Direct_Index) of aliased System.Address;
+     array (Direct_Index_Range) of aliased Direct_Attribute_Element;
 
-   type Direct_Index_Vector is mod 2 ** D_I_Count;
+   type Direct_Index_Vector is mod 2 ** Parameters.Default_Attribute_Count;
    --  This is a bit-vector type, used to store information about
    --  the usage of the direct attribute fields.
 
@@ -832,7 +834,7 @@ package System.Tasking is
       --  signal (and resulting abortion exception) are not handled any more.
       --  In other words, the flag prevents a race between multiple aborters
       --  and the abortee.
-      --  Protection: Self.L.
+      --  Protection: protected by atomic access.
 
       ATC_Hack : Boolean := False;
       pragma Atomic (ATC_Hack);
@@ -857,7 +859,7 @@ package System.Tasking is
 
       Pending_Action : Boolean := False;
       --  Unified flag indicating some action needs to be take when abort
-      --  next becomes undeferred.  Currently set if:
+      --  next becomes undeferred. Currently set if:
       --  . Pending_Priority_Change is set
       --  . Pending_ATC_Level is changed
       --  . Requeue involving POs
@@ -920,10 +922,9 @@ package System.Tasking is
       Known_Tasks_Index : Integer := -1;
       --  Index in the System.Tasking.Debug.Known_Tasks array.
 
-      User_State : Integer := 0;
-      --  user-writeable location, for use in debugging tasks;
-      --  debugger can display this value to show where the task currently
-      --  is, in user terms
+      User_State : Long_Integer := 0;
+      --  User-writeable location, for use in debugging tasks;
+      --  also provides a simple task specific data.
 
       Direct_Attributes : Direct_Attribute_Array;
       --  For task attributes that have same size as Address
@@ -940,7 +941,6 @@ package System.Tasking is
       --  Protection: Self.L. Once a task has set Self.Stage to Completing, it
       --  has exclusive access to this field.
    end record;
-   pragma Volatile (Ada_Task_Control_Block);
 
    ---------------------
    -- Initialize_ATCB --
@@ -970,7 +970,7 @@ private
    pragma Volatile (Activation_Chain);
 
    --  Activation_chain is an in-out parameter of initialization procedures
-   --  and it must be passed by reference because the init_proc may terminate
+   --  and it must be passed by reference because the init proc may terminate
    --  abnormally after creating task components, and these must be properly
    --  registered for removal (Expunge_Unactivated_Tasks).