1 ------------------------------------------------------------------------------
3 -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- S Y S T E M . T A S K I N G . R E N D E Z V O U S --
10 -- Copyright (C) 1992-2001, 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. --
31 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 ------------------------------------------------------------------------------
35 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
36 -- Any changes to this interface may require corresponding compiler changes.
39 -- Used for, Exception_Id
41 with System
.Tasking
.Protected_Objects
.Entries
;
42 -- used for Protection_Entries
44 package System
.Tasking
.Rendezvous
is
46 package STPE
renames System
.Tasking
.Protected_Objects
.Entries
;
48 procedure Task_Entry_Call
51 Uninterpreted_Data
: System
.Address
;
53 Rendezvous_Successful
: out Boolean);
54 -- General entry call used to implement ATC or conditional entry calls.
55 -- Compiler interface only. Do not call from within the RTS.
56 -- Acceptor is the ID of the acceptor task.
57 -- E is the entry index requested.
58 -- Uninterpreted_Data represents the parameters of the entry. It is
59 -- constructed by the compiler for the caller and the callee; therefore,
60 -- the run time never needs to decode this data.
61 -- Mode can be either Asynchronous_Call (ATC) or Conditional_Call.
62 -- Rendezvous_Successful is set to True on return if the call was serviced.
64 procedure Timed_Task_Entry_Call
67 Uninterpreted_Data
: System
.Address
;
70 Rendezvous_Successful
: out Boolean);
71 -- Timed entry call without using ATC.
72 -- Compiler interface only. Do not call from within the RTS.
73 -- See Task_Entry_Call for details on Acceptor, E and Uninterpreted_Data.
74 -- Timeout is the value of the time out.
75 -- Mode determines whether the delay is relative or absolute.
80 Uninterpreted_Data
: System
.Address
);
82 -- Compiler interface only. Do not call from within the RTS.
89 -- P : parms := (parm1, parm2, parm3);
90 -- X : Task_Entry_Index := 1;
92 -- Call_Simple (t._task_id, X, P'Address);
98 procedure Cancel_Task_Entry_Call
(Cancelled
: out Boolean);
99 -- Cancel pending asynchronous task entry call.
100 -- Compiler interface only. Do not call from within the RTS.
101 -- See Exp_Ch9.Expand_N_Asynchronous_Select for code expansion.
103 procedure Requeue_Task_Entry
105 E
: Task_Entry_Index
;
106 With_Abort
: Boolean);
107 -- Requeue from a task entry to a task entry.
108 -- Compiler interface only. Do not call from within the RTS.
109 -- The code generation for task entry requeues is different from that for
110 -- protected entry requeues. There is a "goto" that skips around the call
111 -- to Complete_Rendezvous, so that Requeue_Task_Entry must also do the work
112 -- of Complete_Rendezvous. The difference is that it does not report that
113 -- the call's State = Done.
126 -- accept_call (1, A62b);
128 -- requeue_task_entry (tTV!(t)._task_id, 2, false);
131 -- complete_rendezvous;
135 -- exceptional_complete_rendezvous (current_exception);
138 procedure Requeue_Protected_To_Task_Entry
139 (Object
: STPE
.Protection_Entries_Access
;
141 E
: Task_Entry_Index
;
142 With_Abort
: Boolean);
143 -- Requeue from a protected entry to a task entry.
144 -- Compiler interface only. Do not call from within the RTS.
147 -- entry e2 when b is
155 -- procedure rPT__E14b (O : address; P : address; E :
156 -- protected_entry_index) is
157 -- type rTVP is access rTV;
159 -- _object : rTVP := rTVP!(O);
162 -- rR : protection renames _object._object;
163 -- vP : integer renames _object.v;
164 -- bP : boolean renames _object.b;
168 -- requeue_protected_to_task_entry (rR'unchecked_access, tTV!(t).
169 -- _task_id, 2, false);
172 -- complete_entry_body (_object._object'unchecked_access, objectF =>
177 -- abort_undefer.all;
178 -- exceptional_complete_entry_body (_object._object'
179 -- unchecked_access, current_exception, objectF => 0);
183 procedure Selective_Wait
184 (Open_Accepts
: Accept_List_Access
;
185 Select_Mode
: Select_Modes
;
186 Uninterpreted_Data
: out System
.Address
;
187 Index
: out Select_Index
);
188 -- Implement select statement.
189 -- Compiler interface only. Do not call from within the RTS.
190 -- See comments on Accept_Call.
193 -- select accept e1 do
205 -- A37b (1) := (null_body => false, s => 1);
206 -- A37b (2) := (null_body => true, s => 2);
207 -- S0 : aliased T36b := accept_list'A37b;
208 -- J1 : select_index := 0;
211 -- abort_undefer.all;
214 -- complete_rendezvous;
216 -- when all others =>
217 -- exceptional_complete_rendezvous (get_gnat_exception);
220 -- selective_wait (S0'unchecked_access, simple_mode, A32b, J1);
241 procedure Timed_Selective_Wait
242 (Open_Accepts
: Accept_List_Access
;
243 Select_Mode
: Select_Modes
;
244 Uninterpreted_Data
: out System
.Address
;
247 Index
: out Select_Index
);
248 -- Selective wait with timeout without using ATC.
249 -- Compiler interface only. Do not call from within the RTS.
251 procedure Accept_Call
252 (E
: Task_Entry_Index
;
253 Uninterpreted_Data
: out System
.Address
);
254 -- Accept an entry call.
255 -- Compiler interface only. Do not call from within the RTS.
258 -- accept E do ...A... end E;
263 -- accept_call (1, A27b);
265 -- complete_rendezvous;
268 -- when all others =>
269 -- exceptional_complete_rendezvous (get_gnat_exception);
272 -- The handler for Abort_Signal (*all* others) is to handle the case when
273 -- the acceptor is aborted between Accept_Call and the corresponding
274 -- Complete_Rendezvous call. We need to wake up the caller in this case.
276 -- See also Selective_Wait
278 procedure Accept_Trivial
(E
: Task_Entry_Index
);
279 -- Accept an entry call that has no parameters and no body.
280 -- Compiler interface only. Do not call from within the RTS.
281 -- This should only be called when there is no accept body, or the accept
287 -- accept_trivial (1);
289 -- The compiler is also able to recognize the following and
290 -- translate it the same way.
292 -- accept E do null; end E;
294 function Task_Count
(E
: Task_Entry_Index
) return Natural;
295 -- Return number of tasks waiting on the entry E (of current task)
296 -- Compiler interface only. Do not call from within the RTS.
298 function Callable
(T
: Task_ID
) return Boolean;
300 -- Compiler interface. Do not call from within the RTS, except for body of
301 -- Ada.Task_Identification.
303 type Task_Entry_Nesting_Depth
is new Task_Entry_Index
304 range 0 .. Max_Task_Entry
;
306 function Task_Entry_Caller
(D
: Task_Entry_Nesting_Depth
) return Task_ID
;
307 -- Return E'Caller. This will only work if called from within an
308 -- accept statement that is handling E, as required by the LRM (C.7.1(14)).
309 -- Compiler interface only. Do not call from within the RTS.
311 procedure Complete_Rendezvous
;
312 -- Called by acceptor to wake up caller
314 procedure Exceptional_Complete_Rendezvous
315 (Ex
: Ada
.Exceptions
.Exception_Id
);
316 -- Called by acceptor to mark the end of the current rendezvous and
317 -- propagate an exception to the caller.
319 -- For internal use only:
321 function Task_Do_Or_Queue
323 Entry_Call
: Entry_Call_Link
;
324 With_Abort
: Boolean) return Boolean;
325 -- Call this only with abort deferred and holding no locks, except
326 -- the global RTS lock when Single_Lock is True which must be owned.
327 -- Returns False iff the call cannot be served or queued, as is the
328 -- case if the caller is not callable; i.e., a False return value
329 -- indicates that Tasking_Error should be raised.
330 -- Either initiate the entry call, such that the accepting task is
331 -- free to execute the rendezvous, queue the call on the acceptor's
332 -- queue, or cancel the call. Conditional calls that cannot be
333 -- accepted immediately are cancelled.
335 end System
.Tasking
.Rendezvous
;