1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . T A S K I N G . E N T R Y _ C A L L S --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1992-2009, 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 3, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNAT 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. --
|
17 |
|
|
-- --
|
18 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
19 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
20 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
21 |
|
|
-- --
|
22 |
|
|
-- You should have received a copy of the GNU General Public License and --
|
23 |
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
24 |
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
25 |
|
|
-- <http://www.gnu.org/licenses/>. --
|
26 |
|
|
-- --
|
27 |
|
|
-- GNARL was developed by the GNARL team at Florida State University. --
|
28 |
|
|
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
29 |
|
|
-- --
|
30 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
-- This package provides internal RTS calls implementing operations
|
33 |
|
|
-- that apply to general entry calls, that is, calls to either
|
34 |
|
|
-- protected or task entries.
|
35 |
|
|
|
36 |
|
|
-- These declarations are not part of the GNARL Interface
|
37 |
|
|
|
38 |
|
|
package System.Tasking.Entry_Calls is
|
39 |
|
|
|
40 |
|
|
procedure Wait_For_Completion (Entry_Call : Entry_Call_Link);
|
41 |
|
|
-- This procedure suspends the calling task until the specified entry
|
42 |
|
|
-- call has either been completed or cancelled. It performs other
|
43 |
|
|
-- operations required of suspended tasks, such as performing
|
44 |
|
|
-- dynamic priority changes. On exit, the call will not be queued.
|
45 |
|
|
-- This waits for calls on task or protected entries.
|
46 |
|
|
-- Abortion must be deferred when calling this procedure.
|
47 |
|
|
-- Call this only when holding Self (= Entry_Call.Self) or global RTS lock.
|
48 |
|
|
|
49 |
|
|
procedure Wait_For_Completion_With_Timeout
|
50 |
|
|
(Entry_Call : Entry_Call_Link;
|
51 |
|
|
Wakeup_Time : Duration;
|
52 |
|
|
Mode : Delay_Modes;
|
53 |
|
|
Yielded : out Boolean);
|
54 |
|
|
-- Same as Wait_For_Completion but wait for a timeout with the value
|
55 |
|
|
-- specified in Wakeup_Time as well.
|
56 |
|
|
-- On return, Yielded indicates whether the wait has performed a yield.
|
57 |
|
|
-- Check_Exception must be called after calling this procedure.
|
58 |
|
|
|
59 |
|
|
procedure Wait_Until_Abortable
|
60 |
|
|
(Self_ID : Task_Id;
|
61 |
|
|
Call : Entry_Call_Link);
|
62 |
|
|
-- This procedure suspends the calling task until the specified entry
|
63 |
|
|
-- call is queued abortably or completes.
|
64 |
|
|
-- Abortion must be deferred when calling this procedure, and the global
|
65 |
|
|
-- RTS lock taken when Single_Lock.
|
66 |
|
|
|
67 |
|
|
procedure Try_To_Cancel_Entry_Call (Succeeded : out Boolean);
|
68 |
|
|
pragma Inline (Try_To_Cancel_Entry_Call);
|
69 |
|
|
-- Try to cancel async. entry call.
|
70 |
|
|
-- Effect includes Abort_To_Level and Wait_For_Completion.
|
71 |
|
|
-- Cancelled = True iff the cancellation was successful, i.e.,
|
72 |
|
|
-- the call was not Done before this call.
|
73 |
|
|
-- On return, the call is off-queue and the ATC level is reduced by one.
|
74 |
|
|
|
75 |
|
|
procedure Reset_Priority
|
76 |
|
|
(Acceptor : Task_Id;
|
77 |
|
|
Acceptor_Prev_Priority : Rendezvous_Priority);
|
78 |
|
|
pragma Inline (Reset_Priority);
|
79 |
|
|
-- Reset the priority of a task completing an accept statement to
|
80 |
|
|
-- the value it had before the call.
|
81 |
|
|
-- Acceptor should always be equal to Self.
|
82 |
|
|
|
83 |
|
|
procedure Check_Exception
|
84 |
|
|
(Self_ID : Task_Id;
|
85 |
|
|
Entry_Call : Entry_Call_Link);
|
86 |
|
|
pragma Inline (Check_Exception);
|
87 |
|
|
-- Raise any pending exception from the Entry_Call.
|
88 |
|
|
-- This should be called at the end of every compiler interface procedure
|
89 |
|
|
-- that implements an entry call.
|
90 |
|
|
-- In principle, the caller should not be abort-deferred (unless the
|
91 |
|
|
-- application program violates the Ada language rules by doing entry calls
|
92 |
|
|
-- from within protected operations -- an erroneous practice apparently
|
93 |
|
|
-- followed with success by some adventurous GNAT users).
|
94 |
|
|
-- Absolutely, the caller should not be holding any locks, or there
|
95 |
|
|
-- will be deadlock.
|
96 |
|
|
|
97 |
|
|
end System.Tasking.Entry_Calls;
|