]>
Commit | Line | Data |
---|---|---|
cacbc350 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3084fecd | 3 | -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- |
cacbc350 RK |
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 | -- -- | |
4b490c1e | 9 | -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- |
cacbc350 RK |
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- -- | |
748086b7 JJ |
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- -- | |
cacbc350 | 15 | -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
748086b7 JJ |
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/>. -- | |
cacbc350 | 26 | -- -- |
fbf5a39b AC |
27 | -- GNARL was developed by the GNARL team at Florida State University. -- |
28 | -- Extensive contributions were provided by Ada Core Technologies, Inc. -- | |
cacbc350 RK |
29 | -- -- |
30 | ------------------------------------------------------------------------------ | |
31 | ||
07fc65c4 GB |
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 | ||
cacbc350 RK |
38 | package System.Tasking.Entry_Calls is |
39 | ||
07fc65c4 | 40 | procedure Wait_For_Completion (Entry_Call : Entry_Call_Link); |
cacbc350 RK |
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. | |
07fc65c4 | 47 | -- Call this only when holding Self (= Entry_Call.Self) or global RTS lock. |
cacbc350 RK |
48 | |
49 | procedure Wait_For_Completion_With_Timeout | |
07fc65c4 | 50 | (Entry_Call : Entry_Call_Link; |
cacbc350 | 51 | Wakeup_Time : Duration; |
07fc65c4 GB |
52 | Mode : Delay_Modes; |
53 | Yielded : out Boolean); | |
54 | -- Same as Wait_For_Completion but wait for a timeout with the value | |
cacbc350 | 55 | -- specified in Wakeup_Time as well. |
07fc65c4 GB |
56 | -- On return, Yielded indicates whether the wait has performed a yield. |
57 | -- Check_Exception must be called after calling this procedure. | |
cacbc350 RK |
58 | |
59 | procedure Wait_Until_Abortable | |
b5e792e2 | 60 | (Self_ID : Task_Id; |
07fc65c4 | 61 | Call : Entry_Call_Link); |
cacbc350 RK |
62 | -- This procedure suspends the calling task until the specified entry |
63 | -- call is queued abortably or completes. | |
07fc65c4 GB |
64 | -- Abortion must be deferred when calling this procedure, and the global |
65 | -- RTS lock taken when Single_Lock. | |
cacbc350 RK |
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. | |
12a13f01 | 71 | -- Cancelled = True iff the cancellation was successful, i.e., |
cacbc350 RK |
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 | |
b5e792e2 | 76 | (Acceptor : Task_Id; |
07fc65c4 | 77 | Acceptor_Prev_Priority : Rendezvous_Priority); |
cacbc350 RK |
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. | |
07fc65c4 | 81 | -- Acceptor should always be equal to Self. |
cacbc350 RK |
82 | |
83 | procedure Check_Exception | |
b5e792e2 | 84 | (Self_ID : Task_Id; |
cacbc350 RK |
85 | Entry_Call : Entry_Call_Link); |
86 | pragma Inline (Check_Exception); | |
87 | -- Raise any pending exception from the Entry_Call. | |
07fc65c4 GB |
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). | |
cacbc350 RK |
94 | -- Absolutely, the caller should not be holding any locks, or there |
95 | -- will be deadlock. | |
96 | ||
97 | end System.Tasking.Entry_Calls; |