1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Entry Calls</TITLE>
<META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
<META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
<STYLE type="text/css">
DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
TT {font-family: "Courier New", monospace}
DT {display: compact}
DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Index {font-family: "Times New Roman", Times, serif}
DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left: 10.0em; margin-bottom: 0.6em}
DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 15.0em; margin-bottom: 0.6em}
UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
DD.Hanging {margin-left: 6.0em}
DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.IndentedHanging {margin-left: 2.0em}
DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.HangingInBulleted {margin-left: 4.0em}
DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallHanging {margin-left: 7.5em}
DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallIndentedHanging {margin-left: 2.0em}
DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallHangingInBulleted {margin-left: 5.0em}
DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.Enumerated {margin-left: 2.0em}
DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallEnumerated {margin-left: 2.5em}
DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-9-5-2.html">Previous</A> <A HREF="AA-9-5-4.html">Next</A></P>
<HR>
<H1> 9.5.3 Entry Calls</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3646"></A>[An <FONT FACE="Arial, Helvetica">entry_call_statement</FONT>
(an <I>entry call</I>) can appear in various contexts.] <A NAME="I3647"></A><A NAME="I3648"></A>A
<I>simple</I> entry call is a stand-alone statement that represents an
unconditional call on an entry of a target task or a protected object.
[Entry calls can also appear as part of <FONT FACE="Arial, Helvetica">select_statement</FONT>s
(see <A HREF="AA-9-7.html">9.7</A>).] </DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">entry_call_statement<A NAME="I3649"></A>
::= </FONT><I>entry_</I><A NAME="I3650"></A><FONT FACE="Arial, Helvetica">name</FONT> [<A NAME="I3651"></A><FONT FACE="Arial, Helvetica">actual_parameter_part</FONT>];</DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal"> The <I>entry_</I><FONT FACE="Arial, Helvetica">name</FONT>
given in an <FONT FACE="Arial, Helvetica">entry_call_statement</FONT>
shall resolve to denote an entry. The rules for parameter associations
are the same as for subprogram calls (see <A HREF="AA-6-4.html">6.4</A>
and <A HREF="AA-6-4-1.html">6.4.1</A>). </DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal"> [The <I>entry_</I><FONT FACE="Arial, Helvetica">name</FONT>
of an <FONT FACE="Arial, Helvetica">entry_call_statement</FONT> specifies
(explicitly or implicitly) the target object of the call, the entry or
entry family, and the entry index, if any (see <A HREF="AA-9-5.html">9.5</A>).]
</DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I3652"></A><A NAME="I3653"></A><A NAME="I3654"></A><A NAME="I3655"></A>Under
certain circumstances (detailed below), an entry of a task or protected
object is checked to see whether it is <I>open</I> or <I>closed</I>:
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC><A NAME="I3656"></A><A NAME="I3657"></A>An entry of a task
is open if the task is blocked on an <FONT FACE="Arial, Helvetica">accept_statement</FONT>
that corresponds to the entry (see <A HREF="AA-9-5-2.html">9.5.2</A>),
or on a <FONT FACE="Arial, Helvetica">selective_accept</FONT> (see <A HREF="AA-9-7-1.html">9.7.1</A>)
with an open <FONT FACE="Arial, Helvetica">accept_alternative</FONT>
that corresponds to the entry; otherwise it is closed.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC><A NAME="I3658"></A><A NAME="I3659"></A>An entry of a protected
object is open if the <FONT FACE="Arial, Helvetica">condition</FONT>
of the <FONT FACE="Arial, Helvetica">entry_barrier</FONT> of the corresponding
<FONT FACE="Arial, Helvetica">entry_body</FONT> evaluates to True; otherwise
it is closed. <A NAME="I3660"></A>If the evaluation of the <FONT FACE="Arial, Helvetica">condition</FONT>
propagates an exception, the exception Program_Error is propagated to
all current callers of all entries of the protected object. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>7.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>An exception during
barrier evaluation is considered essentially a fatal error. All current
entry callers are notified with a Program_Error. In a fault-tolerant
system, a protected object might provide a Reset protected procedure,
or equivalent, to support attempts to restore such a "broken"
protected object to a reasonable state. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Note that the
definition of when a task entry is open is based on the state of the
(accepting) task, whereas the "openness" of a protected entry
is defined only when it is explicitly checked, since the barrier expression
needs to be evaluated. Implementation permissions are given (below) to
allow implementations to evaluate the barrier expression more or less
often than it is checked, but the basic semantic model presumes it is
evaluated at the times when it is checked. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I3661"></A>For
the execution of an <FONT FACE="Arial, Helvetica">entry_call_statement</FONT>,
evaluation of the <FONT FACE="Arial, Helvetica">name</FONT> and of the
parameter associations is as for a subprogram call (see <A HREF="AA-6-4.html">6.4</A>).
<A NAME="I3662"></A>The entry call is then <I>issued</I>: For a call
on an entry of a protected object, a new protected action is started
on the object (see <A HREF="AA-9-5-1.html">9.5.1</A>). The named entry
is checked to see if it is open; <A NAME="I3663"></A>if open, the entry
call is said to be <I>selected immediately</I>, and the execution of
the call proceeds as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>For a call on an open entry of a task, the accepting task
becomes ready and continues the execution of the corresponding <FONT FACE="Arial, Helvetica">accept_statement</FONT>
(see <A HREF="AA-9-5-2.html">9.5.2</A>).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>For a call on an open entry of a protected object, the
corresponding <FONT FACE="Arial, Helvetica">entry_body</FONT> is executed
(see <A HREF="AA-9-5-2.html">9.5.2</A>) as part of the protected action.
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal"> If the <FONT FACE="Arial, Helvetica">accept_statement</FONT>
or <FONT FACE="Arial, Helvetica">entry_body</FONT> completes other than
by a requeue (see <A HREF="AA-9-5-4.html">9.5.4</A>), return is made
to the caller (after servicing the entry queues -- see below); any necessary
assigning back of formal to actual parameters occurs, as for a subprogram
call (see <A HREF="AA-6-4-1.html">6.4.1</A>); such assignments take place
outside of any protected action. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>The return
to the caller will generally not occur until the protected action completes,
unless some other thread of control is given the job of completing the
protected action and releasing the associated execution resource. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal"> If the named entry is closed, the entry call
is added to an <I>entry queue</I> (as part of the protected action, for
a call on a protected entry), and the call remains queued until it is
selected or cancelled; <A NAME="I3664"></A>there is a separate (logical)
entry queue for each entry of a given task or protected object [(including
each entry of an entry family)].</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I3665"></A><A NAME="I3666"></A>When
a queued call is <I>selected</I>, it is removed from its entry queue.
Selecting a queued call from a particular entry queue is called <I>servicing</I>
the entry queue. An entry with queued calls can be serviced under the
following circumstances: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>When the associated task reaches a corresponding <FONT FACE="Arial, Helvetica">accept_statement</FONT>,
or a <FONT FACE="Arial, Helvetica">selective_accept</FONT> with a corresponding
open <FONT FACE="Arial, Helvetica">accept_alternative</FONT>;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If after performing, as part of a protected action on the
associated protected object, an operation on the object other than a
call on a protected function, the entry is checked and found to be open.
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3667"></A>If there is at least one
call on a queue corresponding to an open entry, then one such call is
selected according to the <I>entry queuing policy</I> in effect (see
below), and the corresponding <FONT FACE="Arial, Helvetica">accept_statement</FONT>
or <FONT FACE="Arial, Helvetica">entry_body</FONT> is executed as above
for an entry call that is selected immediately.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3668"></A>The entry queuing policy
controls selection among queued calls both for task and protected entry
queues. <A NAME="I3669"></A><A NAME="I3670"></A>The default entry queuing
policy is to select calls on a given entry queue in order of arrival.
If calls from two or more queues are simultaneously eligible for selection,
the default entry queuing policy does not specify which queue is serviced
first. Other entry queuing policies can be specified by <FONT FACE="Arial, Helvetica">pragma</FONT>s
(see <A HREF="AA-D-4.html">D.4</A>).</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal"> For a protected object, the above servicing of
entry queues continues until there are no open entries with queued calls,
at which point the protected action completes. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>While servicing
the entry queues of a protected object, no new calls can be added to
any entry queue of the object, except due to an internal requeue (see
<A HREF="AA-9-5-4.html">9.5.4</A>). This is because the first step of
a call on a protected entry is to start a new protected action, which
implies acquiring (for exclusive read-write access) the execution resource
associated with the protected object, which cannot be done while another
protected action is already in progress. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3671"></A>For an entry call that is
added to a queue, and that is not the <FONT FACE="Arial, Helvetica">triggering_statement</FONT>
of an <FONT FACE="Arial, Helvetica">asynchronous_select</FONT> (see <A HREF="AA-9-7-4.html">9.7.4</A>),
the calling task is blocked until the call is cancelled, or the call
is selected and a corresponding <FONT FACE="Arial, Helvetica">accept_statement</FONT>
or <FONT FACE="Arial, Helvetica">entry_body</FONT> completes without
requeuing. In addition, the calling task is blocked during a rendezvous.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>For a call
on a protected entry, the caller is not blocked if the call is selected
immediately, unless a requeue causes the call to be queued.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3672"></A>An attempt can be made to
cancel an entry call upon an abort (see <A HREF="AA-9-8.html">9.8</A>)
and as part of certain forms of <FONT FACE="Arial, Helvetica">select_statement</FONT>
(see <A HREF="AA-9-7-2.html">9.7.2</A>, <A HREF="AA-9-7-3.html">9.7.3</A>,
and <A HREF="AA-9-7-4.html">9.7.4</A>). The cancellation does not take
place until a point (if any) when the call is on some entry queue, and
not protected from cancellation as part of a requeue (see <A HREF="AA-9-5-4.html">9.5.4</A>);
at such a point, the call is removed from the entry queue and the call
completes due to the cancellation. The cancellation of a call on an entry
of a protected object is a protected action[, and as such cannot take
place while any other protected action is occurring on the protected
object. Like any protected action, it includes servicing of the entry
queues (in case some entry barrier depends on a Count attribute).] </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>In
the case of an attempted cancellation due to abort, this removal might
have to be performed by the calling task itself if the ceiling priority
of the protected object is lower than the task initiating the abort.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal"> <A NAME="I3673"></A>A call on an entry of a task
that has already completed its execution raises the exception Tasking_Error
at the point of the call; similarly, this exception is raised at the
point of the call if the called task completes its execution or becomes
abnormal before accepting the call or completing the rendezvous (see
<A HREF="AA-9-8.html">9.8</A>). This applies equally to a simple entry
call and to an entry call as part of a <FONT FACE="Arial, Helvetica">select_statement</FONT>.</DIV>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Normal"> An implementation may perform the sequence of
steps of a protected action using any thread of control; it need not
be that of the task that started the protected action. If an <FONT FACE="Arial, Helvetica">entry_body</FONT>
completes without requeuing, then the corresponding calling task may
be made ready without waiting for the entire protected action to complete.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>These permissions
are intended to allow flexibility for implementations on multiprocessors.
On a monoprocessor, which thread of control executes the protected action
is essentially invisible, since the thread is not abortable in any case,
and the "current_task" function is not guaranteed to work during
a protected action (see <A HREF="AA-C-7.html">C.7</A>). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Normal"> When the entry of a protected object is checked
to see whether it is open, the implementation need not reevaluate the
<FONT FACE="Arial, Helvetica">condition</FONT> of the corresponding <FONT FACE="Arial, Helvetica">entry_barrier</FONT>
if no variable or attribute referenced by the <FONT FACE="Arial, Helvetica">condition</FONT>
(directly or indirectly) has been altered by the execution (or cancellation)
of a protected procedure or entry call on the object since the <FONT FACE="Arial, Helvetica">condition</FONT>
was last evaluated. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Changes to
variables referenced by an entry barrier that result from actions outside
of a protected procedure or entry call on the protected object need not
be "noticed." For example, if a global variable is referenced
by an entry barrier, it should not be altered (except as part of a protected
action on the object) any time after the barrier is first evaluated.
In other words, globals can be used to "parameterize" a protected
object, but they cannot reliably be used to control it after the first
use of the protected object. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>Note
that even if a global variable is volatile, the implementation need only
reevaluate a barrier if the global is updated during a protected action
on the protected object. This ensures that an entry-open bit-vector implementation
approach is possible, where the bit-vector is computed at the end of
a protected action, rather than upon each entry call. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Normal"> An implementation may evaluate the <FONT FACE="Arial, Helvetica">condition</FONT>s
of all <FONT FACE="Arial, Helvetica">entry_barrier</FONT>s of a given
protected object any time any entry of the object is checked to see if
it is open. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>In other
words, any side-effects of evaluating an entry barrier should be innocuous,
since an entry barrier might be evaluated more or less often than is
implied by the "official" dynamic semantics. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>It
is anticipated that when the number of entries is known to be small,
all barriers will be evaluated any time one of them needs to be, to produce
an "entry-open bit-vector." The appropriate bit will be tested
when the entry is called, and only if the bit is false will a check be
made to see whether the bit-vector might need to be recomputed. This
should allow an implementation to maximize the performance of a call
on an open entry, which seems like the most important case.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>In addition to the entry-open
bit-vector, an "is-valid" bit is needed per object, which indicates
whether the current bit-vector setting is valid. A "depends-on-Count-attribute"
bit is needed per type. The "is-valid" bit is set to false
(as are all the bits of the bit-vector) when the protected object is
first created, as well as any time an exception is propagated from computing
the bit-vector. Is-valid would also be set false any time the Count is
changed and "depends-on-Count-attribute" is true for the type,
or a protected procedure or entry returns indicating it might have updated
a variable referenced in some barrier.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>A single procedure can be compiled
to evaluate all of the barriers, set the entry-open bit-vector accordingly,
and set the is-valid bit to true. It could have a "when others"
handler to set them all false, and call a routine to propagate Program_Error
to all queued callers.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>For protected types where the
number of entries is not known to be small, it makes more sense to evaluate
a barrier only when the corresponding entry is checked to see if it is
open. It isn't worth saving the state of the entry between checks, because
of the space that would be required. Furthermore, the entry queues probably
want to take up space only when there is actually a caller on them, so
rather than an array of all entry queues, a linked list of nonempty entry
queues make the most sense in this case, with the first caller on each
entry queue acting as the queue header. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal"> When an attempt is made to cancel an entry call,
the implementation need not make the attempt using the thread of control
of the task (or interrupt) that initiated the cancellation; in particular,
it may use the thread of control of the caller itself to attempt the
cancellation, even if this might allow the entry call to be selected
in the interim. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>Because cancellation
of a protected entry call is a protected action (which helps make the
Count attribute of a protected entry meaningful), it might not be practical
to attempt the cancellation from the thread of control that initiated
the cancellation. For example, if the cancellation is due to the expiration
of a delay, it is unlikely that the handler of the timer interrupt could
perform the necessary protected action itself (due to being on the interrupt
level). Similarly, if the cancellation is due to an abort, it is possible
that the task initiating the abort has a priority higher than the ceiling
priority of the protected object (for implementations that support ceiling
priorities). Similar considerations could apply in a multiprocessor situation.
</FONT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>26 If an exception is raised
during the execution of an <FONT FACE="Arial, Helvetica">entry_body</FONT>,
it is propagated to the corresponding caller (see <A HREF="AA-11-4.html">11.4</A>).</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>27 For a call on a protected
entry, the entry is checked to see if it is open prior to queuing the
call, and again thereafter if its Count attribute (see <A HREF="AA-9-9.html">9.9</A>)
is referenced in some entry barrier. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Given this,
extra care is required if a reference to the Count attribute of an entry
appears in the entry's own barrier. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>An entry is checked
to see if it is open prior to queuing to maximize the performance of
a call on an open entry. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>28 In addition to simple
entry calls, the language permits timed, conditional, and asynchronous
entry calls (see <A HREF="AA-9-7-2.html">9.7.2</A>, <A HREF="AA-9-7-3.html">9.7.3</A>,
and see <A HREF="AA-9-7-4.html">9.7.4</A>). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A task can
call its own entries, but the task will deadlock if the call is a simple
entry call. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>29 The <FONT FACE="Arial, Helvetica">condition</FONT>
of an <FONT FACE="Arial, Helvetica">entry_barrier</FONT> is allowed to
be evaluated by an implementation more often than strictly necessary,
even if the evaluation might have side effects. On the other hand, an
implementation need not reevaluate the <FONT FACE="Arial, Helvetica">condition</FONT>
if nothing it references was updated by an intervening protected action
on the protected object, even if the <FONT FACE="Arial, Helvetica">condition</FONT>
references some global variable that might have been updated by an action
performed from outside of a protected action. </FONT></DIV>
<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
entry calls:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Examples"><TT>Agent.Shut_Down; <I>-- see <A HREF="AA-9-1.html">9.1</A></I><BR>
Parser.Next_Lexeme(E); <I>-- see <A HREF="AA-9-1.html">9.1</A></I><BR>
Pool(5).Read(Next_Char); <I>-- see <A HREF="AA-9-1.html">9.1</A></I><BR>
Controller.Request(Low)(Some_Item); <I>-- see <A HREF="AA-9-1.html">9.1</A></I><BR>
Flags(3).Seize; <I>-- see <A HREF="AA-9-4.html">9.4</A></I></TT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-9-5-2.html">Previous</A> <A HREF="AA-9-5-4.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|