OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tasuti.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                 GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS              --
4 --                                                                          --
5 --              S Y S T E M . T A S K I N G . U T I L I T I E S             --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --                             $Revision: 1.34 $                            --
10 --                                                                          --
11 --             Copyright (C) 1991-1998 Florida State University             --
12 --                                                                          --
13 -- GNARL is free software; you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- As a special exception,  if other files  instantiate  generics from this --
25 -- unit, or you link  this unit with other files  to produce an executable, --
26 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
27 -- covered  by the  GNU  General  Public  License.  This exception does not --
28 -- however invalidate  any other reasons why  the executable file  might be --
29 -- covered by the  GNU Public License.                                      --
30 --                                                                          --
31 -- GNARL was developed by the GNARL team at Florida State University. It is --
32 -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
33 -- State University (http://www.gnat.com).                                  --
34 --                                                                          --
35 ------------------------------------------------------------------------------
36
37 --  This package provides RTS Internal Declarations.
38 --  These declarations are not part of the GNARLI
39
40 with Unchecked_Conversion;
41
42 package System.Tasking.Utilities is
43
44    function ATCB_To_Address is new
45      Unchecked_Conversion (Task_ID, System.Address);
46
47    ---------------------------------
48    -- Task_Stage Related routines --
49    ---------------------------------
50
51    procedure Make_Independent;
52    --  Move the current task to the outermost level (level 1) of the master
53    --  master hierarchy of the environment task. This is one level further
54    --  out than normal tasks defined in library-level packages (level 2).
55    --  The environment task will wait for level 2 tasks to terminate normally,
56    --  then it will abort all the level 1 tasks. See Finalize_Global_Tasks
57    --  procedure for more information.
58    --
59    --  This is a dangerous operation, and should only be used on nested tasks
60    --  or tasks that depend on any objects that might be finalized earlier than
61    --  the termination of the environment task. It is for internal use by
62    --  GNARL, to prevent such internal server tasks from preventing a
63    --  partition from terminating.
64
65    Independent_Task_Count : Natural := 0;
66    --  Number of independent task. This counter is incremented each time
67    --  Make_Independent is called. Note that if a server task terminates,
68    --  this counter will not be decremented. Since Make_Independent locks
69    --  the environment task (because every independent task depends on it),
70    --  this counter is protected by the environment task's lock.
71
72    ------------------------------------
73    -- Task Abortion related routines --
74    ------------------------------------
75
76    procedure Cancel_Queued_Entry_Calls (T : Task_ID);
77    --  Cancel any entry calls queued on target task.
78    --  Do not call this while holding any locks.
79
80    procedure Exit_One_ATC_Level (Self_ID : Task_ID);
81    pragma Inline (Exit_One_ATC_Level);
82    --  Call only with abort deferred and holding lock of Self_ID.
83    --  This is a bit of common code for all entry calls.
84    --  The effect is to exit one level of ATC nesting.
85
86    procedure Abort_One_Task
87      (Self_ID : Task_ID;
88       T       : Task_ID);
89    --  Similar to Locked_Abort_To_Level (Self_ID, T, 0), but:
90    --    (1) caller should be holding no locks
91    --    (2) may be called for tasks that have not yet been activated
92    --    (3) always aborts whole task
93
94    procedure Abort_Tasks (Tasks : Task_List);
95    --  Abort_Tasks is called to initiate abortion, however, the actual
96    --  abortion is done by abortee by means of Abort_Handler
97
98    procedure Make_Passive
99      (Self_ID : Task_ID;
100       Task_Completed : Boolean);
101    --  Update counts to indicate current task is either terminated
102    --  or accepting on a terminate alternative. Call holding no locks.
103
104 end System.Tasking.Utilities;