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