OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tasren.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
4 --                                                                          --
5 --             S Y S T E M . T A S K I N G . R E N D E Z V O U S            --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --                             $Revision: 1.26 $                            --
10 --                                                                          --
11 --          Copyright (C) 1992-1998, Free Software Foundation, Inc.         --
12 --                                                                          --
13 -- GNARL is free software; you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- As a special exception,  if other files  instantiate  generics from this --
25 -- unit, or you link  this unit with other files  to produce an executable, --
26 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
27 -- covered  by the  GNU  General  Public  License.  This exception does not --
28 -- however invalidate  any other reasons why  the executable file  might be --
29 -- covered by the  GNU Public License.                                      --
30 --                                                                          --
31 -- GNARL was developed by the GNARL team at Florida State University. It is --
32 -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
33 -- State University (http://www.gnat.com).                                  --
34 --                                                                          --
35 ------------------------------------------------------------------------------
36
37 --  Note: the compiler generates direct calls to this interface, via Rtsfind.
38 --  Any changes to this interface may require corresponding compiler changes.
39
40 with Ada.Exceptions;
41 --  Used for, Exception_Id
42
43 with System.Tasking.Protected_Objects.Entries;
44 --  used for Protection_Entries
45
46 package System.Tasking.Rendezvous is
47    --  This interface is described in the document
48    --  Gnu Ada Runtime Library Interface (GNARLI).
49
50    package STPE renames System.Tasking.Protected_Objects.Entries;
51
52    procedure Task_Entry_Call
53      (Acceptor              : Task_ID;
54       E                     : Task_Entry_Index;
55       Uninterpreted_Data    : System.Address;
56       Mode                  : Call_Modes;
57       Rendezvous_Successful : out Boolean);
58    --  General entry call
59
60    procedure Timed_Task_Entry_Call
61      (Acceptor              : Task_ID;
62       E                     : Task_Entry_Index;
63       Uninterpreted_Data    : System.Address;
64       Timeout               : Duration;
65       Mode                  : Delay_Modes;
66       Rendezvous_Successful : out Boolean);
67    --  Timed entry call without using ATC.
68
69    procedure Call_Simple
70      (Acceptor           : Task_ID;
71       E                  : Task_Entry_Index;
72       Uninterpreted_Data : System.Address);
73    --  Simple entry call
74
75    procedure Cancel_Task_Entry_Call (Cancelled : out Boolean);
76    --  Cancel pending task entry call
77
78    procedure Requeue_Task_Entry
79      (Acceptor   : Task_ID;
80       E          : Task_Entry_Index;
81       With_Abort : Boolean);
82
83    procedure Requeue_Protected_To_Task_Entry
84      (Object     : STPE.Protection_Entries_Access;
85       Acceptor   : Task_ID;
86       E          : Task_Entry_Index;
87       With_Abort : Boolean);
88
89    procedure Selective_Wait
90      (Open_Accepts       : Accept_List_Access;
91       Select_Mode        : Select_Modes;
92       Uninterpreted_Data : out System.Address;
93       Index              : out Select_Index);
94    --  Selective wait
95
96    procedure Timed_Selective_Wait
97      (Open_Accepts       : Accept_List_Access;
98       Select_Mode        : Select_Modes;
99       Uninterpreted_Data : out System.Address;
100       Timeout            : Duration;
101       Mode               : Delay_Modes;
102       Index              : out Select_Index);
103    --  Selective wait with timeout without using ATC.
104
105    procedure Accept_Call
106      (E                  : Task_Entry_Index;
107       Uninterpreted_Data : out System.Address);
108    --  Accept an entry call
109
110    procedure Accept_Trivial (E : Task_Entry_Index);
111    --  Accept an entry call that has no parameters and no body
112
113    function Task_Count (E : Task_Entry_Index) return Natural;
114    --  Return number of tasks waiting on the entry E (of current task)
115
116    function Callable (T : Task_ID) return Boolean;
117    --  Return T'CALLABLE
118
119    type Task_Entry_Nesting_Depth is new Task_Entry_Index
120      range 0 .. Max_Task_Entry;
121
122    function Task_Entry_Caller (D : Task_Entry_Nesting_Depth) return Task_ID;
123    --  Return E'Caller.  This will only work if called from within an
124    --  accept statement that is handling E, as required by the
125    --  LRM (C.7.1(14)).
126
127    procedure Complete_Rendezvous;
128    --  Called by acceptor to wake up caller
129
130    procedure Exceptional_Complete_Rendezvous
131      (Ex : Ada.Exceptions.Exception_Id);
132    --  Called by acceptor to mark the end of the current rendezvous and
133    --  propagate an exception to the caller.
134
135    --  For internal use only:
136
137    function Task_Do_Or_Queue
138      (Self_ID    : Task_ID;
139       Entry_Call : Entry_Call_Link;
140       With_Abort : Boolean) return Boolean;
141    --  Call this only with abort deferred and holding lock of Acceptor.
142    --  Returns False iff the call cannot be served or queued, as is the
143    --  case if the caller is not callable; i.e., a False return value
144    --  indicates that Tasking_Error should be raised.
145    --  Either initiate the entry call, such that the accepting task is
146    --  free to execute the rendezvous, queue the call on the acceptor's
147    --  queue, or cancel the call.  Conditional calls that cannot be
148    --  accepted immediately are cancelled.
149
150 end System.Tasking.Rendezvous;