2008-05-07 Kai Tietz <kai,tietz@onevision.com>
[official-gcc.git] / gcc / ada / s-tasuti.ads
blob83709f704b02472d9742729fb1f1a12da7b648a1
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT 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 -- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
10 -- --
11 -- GNARL is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNARL; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNARL was developed by the GNARL team at Florida State University. --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package provides RTS Internal Declarations.
35 -- These declarations are not part of the GNARLI
37 with Ada.Unchecked_Conversion;
38 with System.Task_Primitives;
40 package System.Tasking.Utilities is
42 function ATCB_To_Address is new
43 Ada.Unchecked_Conversion (Task_Id, System.Task_Primitives.Task_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
61 -- from terminating.
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 Abort 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 abort, however, the actual
98 -- aborting is done by aborted task 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 or
102 -- accepting on a terminate alternative. Call holding no locks except
103 -- Global_Task_Lock when calling from Terminate_Task, and RTS_Lock when
104 -- Single_Lock is True.
106 end System.Tasking.Utilities;