Aborting Task Aborted Tasks Dependents of Aborted Tasks
4.6. THE SUPERVISOR INTERFACE 81 The SCOPE NUMBER TYPE is used for numbering nested declarative regions of a
4.6.9 The ACCEPT BEGIN Procedure
Selective waits and simple
accept
statements are compiled into either one or two procedure calls. The rst procedure is ACCEPT BEGIN, whose declaration is shown in Figure 37. The second procedure, which is called if anaccept
alternative is selected, is ACCEPT END,procedure ENTRY CALL(MY NAME : in TASK NAME CALLEE T NAME : in TASK NAME CALLEE E NAME : in ENTRY NAME IN PARAMS : in PARAM LIST
TIME OUT : in DURATION
OUT PARAMS : out PARAM LISTREF
ACCEPTED : out BOOLEAN
ABORTED : out BOOLEAN
MY NODE : in out NODE IDTYPE) ;;jwhere
;; MY NAME's scope is unchanged:
;;j CURRENT SCOPE (MY NAME)= inCURRENT SCOPE (MYNAME), ;; A task cannot rendezvous with itself:
;;j out(ACCEPTED;
>
MY NAME=
=CALLEE T NAME),;; For a simple entry call by a caller that is not abnormal, ENTRY CALL ;; will not terminate until the call is accepted:
;;j out(TIME OUT =DURATION'LAST and notABORTED ;
>
;;j ACCEPTED),
;; The called entry must have been declared by CALLEE T NAME: ;;j 1
<
=CALLEE ENAME<
= ENTRYCOUNT (CALLEE T NAME), ;; An unaccepted timed entry call by a caller that is not abnormal ;; lasts at least as long as TIME OUT:;;j out(notABORTED and notACCEPTED ;
>
;;j CALENDAR.CLOCK; inCALENDAR.CLOCK
>
=TIME OUT),;; An aborted task is no longer CALLABLE i.e., any evaluation of the CALLABLE ;; attribute on MY NAME should return FALSE if ABORTED is TRUE:
;;j out(ABORTED ;
>
;;j (for all T1 : TASK NAME N1: NODE IDTYPE =
>
;;j notCALLABLEATTR(T1,MY NAME, N1))), ;; Execution of an entry call can cause TASKING ERROR to be ;; propagated to the caller:;;j raiseTASKING ERROR
4.6. THE SUPERVISOR INTERFACE 87
procedure ACCEPT BEGIN (MYNAME : in TASK NAME GUARDS : in GUARD ARRAY INDICES : in INDEXARRAY TIMEOUT : in DURATION TERMALT : in BOOLEAN
IN PARAMS: out PARAM LIST REF INDEX : out NATURAL
ABORTED : out BOOLEAN MY NODE : in out NODE IDTYPE) ;;jwhere
;; MY NAME's scope is unchanged:
;;j CURRENT SCOPE (MY NAME)= inCURRENT SCOPE (MYNAME), ;; GUARDS and INDICES have one component per entry of MY NAME ;; plus an extra one:
;;j GUARDS'LAST= INDICES'LAST= ENTRYCOUNT (MY NAME)+1, ;; Execution of the delay alternative of a selective wait must occur
;; after TIME OUT has elapsed:
;;j out(notABORTED and notTERM ALT and ;;j inTIME OUT
<
DURATION'LAST and ;;j GUARDS(GUARDS'LAST) and;;j INDEX=INDICES(INDICES'LAST);
>
;;j CALENDAR.CLOCK; inCALENDAR.CLOCK
>
=TIME OUT), ;; Execution of a selective wait with all alternatives closed results in the ;; propagation of PROGRAM ERROR to the accepting task:;;j (for all I1: GUARDS'RANGE =
>
not GUARDS(I1)) =>
;;j raise PROGRAM ERROR,;; The value returned in INDEX must be a component of INDICES: ;;j out(notABORTED ;
>
;;j exist I1: INDICES'RANGE=
>
INDEX= INDICES(I1)), ;; An aborted task is no longer CALLABLE:;;j out(ABORTED ;
>
;;j (for all T1 : TASK NAME N1: NODE IDTYPE =
>
;;j notCALLABLEATTR(T1,MY NAME, N1)))described in the next section.
MY NAME is set to the name of the task executing the simple
accept
or selective wait. The possible forms ofaccept
statement or selective wait are dierentiated by the values of the parameters TERM ALT, TIME OUT and GUARDS. GUARDS and INDICES are arrays ofN
+ 1 components|the rstN
components for theN
entries of MY NAME, and theN
+ 1th
component for anelse
part,delay
alternative orterminate
alterna- tive. TERM ALT is set to TRUE only when executing a selective wait with aterminate
alternative.A simple
accept
statement for entry numberK
will have GUARDS (K
) set to TRUE and all other GUARDS set to FALSE. If an entry is named as anaccept
alternative in a selective wait, the GUARDS component for the entry is set to the value of the guard on the alternative, or to TRUE if the alternative is unguarded. If an entry is not named in a selective wait, its GUARDS component is set to FALSE. If an entry is named in multipleaccept
alternatives of a selective wait, a single open alternative for the entry (if one exists) is chosen at runtime in an unspecied manner.For a selective wait with an
else
part, GUARDS (N
+1) is set to TRUE and TIME OUT is set to zero. For a selective wait with aterminate
alternative, TERM ALT is set to TRUE, TIME OUT is set to DURATION'LAST (\innity") and GUARDS (N
+ 1) is set to the value of the guard on theterminate
alternative (or TRUE if there is no guard). For a selective wait with one or moredelay
alternatives, a single open alternative with the smallest delay value (if one exists) is chosen at runtime in an unspecied manner TIME OUT is set to the chosen delay value. For a selective wait that contains onlyaccept
alternatives, GUARDS (N
+ 1) is set to FALSE.The function of INDICES was explained in Section 4.6.1 the component of INDICES corresponding to the chosen alternative is returned in INDEX. The values of
in
-mode parameters to a selectedaccept
are available in IN PARAMS upon termination of the procedure. Since anaccept
statement and selective wait are both synchronization points for completion of an abnormal task, an ABNORMAL parameter is provided.ACCEPT BEGIN performs the beginning of the rendezvous message sequence of the Weatherly protocol. Characteristics of ACCEPT BEGIN which are a consequence of the semantics of Ada are formally specied in Anna in Figure 37.
4.6. THE SUPERVISOR INTERFACE 89
procedure ACCEPT END (MY NAME : in TASK NAME OUT PARAMS : in PARAM LIST LIST
ABORTED : out BOOLEAN
MY NODE : in out NODE IDTYPE) ;;jwhere
;; MY NAME's scope is unchanged:
;;j CURRENT SCOPE (MY NAME)= inCURRENT SCOPE (MYNAME), ;; An aborted task is no longer CALLABLE:
;;j out(ABORTED ;
>
;;j (for all T1 : TASK NAME N1: NODE IDTYPE =
>
;;j notCALLABLEATTR(T1,MY NAME, N1)))Figure 38: The Supervisor ACCEPT END Procedure.