| 1 |
------------------------------------------------------------------------------ |
| 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-2025, 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. |
| 65 |
|
| 66 |
procedure Try_To_Cancel_Entry_Call (Succeeded : out Boolean); |
| 67 |
pragma Inline (Try_To_Cancel_Entry_Call); |
| 68 |
-- Try to cancel async. entry call. |
| 69 |
-- Effect includes Abort_To_Level and Wait_For_Completion. |
| 70 |
-- Cancelled = True iff the cancellation was successful, i.e., |
| 71 |
-- the call was not Done before this call. |
| 72 |
-- On return, the call is off-queue and the ATC level is reduced by one. |
| 73 |
|
| 74 |
procedure Reset_Priority |
| 75 |
(Acceptor : Task_Id; |
| 76 |
Acceptor_Prev_Priority : Rendezvous_Priority); |
| 77 |
pragma Inline (Reset_Priority); |
| 78 |
-- Reset the priority of a task completing an accept statement to |
| 79 |
-- the value it had before the call. |
| 80 |
-- Acceptor should always be equal to Self. |
| 81 |
|
| 82 |
procedure Check_Exception |
| 83 |
(Self_ID : Task_Id; |
| 84 |
Entry_Call : Entry_Call_Link); |
| 85 |
pragma Inline (Check_Exception); |
| 86 |
-- Raise any pending exception from the Entry_Call. |
| 87 |
-- This should be called at the end of every compiler interface procedure |
| 88 |
-- that implements an entry call. |
| 89 |
-- In principle, the caller should not be abort-deferred (unless the |
| 90 |
-- application program violates the Ada language rules by doing entry calls |
| 91 |
-- from within protected operations -- an erroneous practice apparently |
| 92 |
-- followed with success by some adventurous GNAT users). |
| 93 |
-- Absolutely, the caller should not be holding any locks, or there |
| 94 |
-- will be deadlock. |
| 95 |
|
| 96 |
end System.Tasking.Entry_Calls; |