1-- C97303B.ADA
2
3--                             Grant of Unlimited Rights
4--
5--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7--     unlimited rights in the software and documentation contained herein.
8--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
9--     this public release, the Government intends to confer upon all
10--     recipients unlimited rights  equal to those held by the Government.
11--     These rights include rights to use, duplicate, release or disclose the
12--     released technical data and computer software in whole or in part, in
13--     any manner and for any purpose whatsoever, and to have or permit others
14--     to do so.
15--
16--                                    DISCLAIMER
17--
18--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23--     PARTICULAR PURPOSE OF SAID MATERIAL.
24--*
25-- CHECK THAT A TIMED_ENTRY_CALL CAN APPEAR IN PLACES WHERE A
26--     SELECTIVE_WAIT  CANNOT.
27
28-- PART 2: PROCEDURE BODY EMBEDDED IN TASK BODY.
29
30
31-- RM 4/12/1982
32
33with Impdef;
34WITH REPORT;
35USE REPORT;
36PROCEDURE  C97303B  IS
37
38
39BEGIN
40
41
42     TEST ( "C97303B" , "CHECK THAT A  TIMED_ENTRY_CALL  CAN" &
43                        " APPEAR WHERE A  SELECTIVE_WAIT  CANNOT" );
44
45
46     -------------------------------------------------------------------
47
48
49     DECLARE
50
51
52          TASK  TT  IS
53               ENTRY  A ( AUTHORIZED : IN BOOLEAN );
54          END  TT ;
55
56
57          TASK BODY  TT  IS
58
59
60               PROCEDURE  WITHIN_TASK_BODY ;
61
62
63               PROCEDURE  WITHIN_TASK_BODY  IS
64               BEGIN
65
66                    SELECT  -- NOT A SELECTIVE_WAIT
67                         A ( FALSE ) ;  -- CALLING (OWN) ENTRY
68                    OR
69                         DELAY 1.0 * Impdef.One_Second;
70                         COMMENT( "ALTERNATIVE BRANCH TAKEN" );
71                    END SELECT;
72
73               END  WITHIN_TASK_BODY ;
74
75
76          BEGIN
77
78
79               -- CALL THE INNER PROC. TO FORCE EXEC. OF TIMED_E_CALL
80               WITHIN_TASK_BODY ;
81
82
83               ACCEPT  A ( AUTHORIZED : IN BOOLEAN )  DO
84
85                    IF  AUTHORIZED  THEN
86                         COMMENT(  "AUTHORIZED ENTRY_CALL" );
87                    ELSE
88                         FAILED( "UNAUTHORIZED ENTRY_CALL" );
89                    END IF;
90
91               END  A ;
92
93          END  TT ;
94
95
96          PROCEDURE  OUTSIDE_TASK_BODY  IS
97          BEGIN
98
99               SELECT  -- NOT A SELECTIVE_WAIT
100                    TT.A ( FALSE ) ;  -- UNBORN
101               OR
102                    DELAY 1.0 * Impdef.One_Second;
103                    COMMENT( "(OUT:) ALTERNATIVE BRANCH TAKEN" );
104               END SELECT;
105
106          END  OUTSIDE_TASK_BODY ;
107
108
109          PACKAGE       CREATE_OPPORTUNITY_TO_CALL           IS END;
110          PACKAGE BODY  CREATE_OPPORTUNITY_TO_CALL  IS
111          BEGIN
112               -- CALL THE OTHER PROC. TO FORCE EXEC. OF TIMED_E_CALL
113               OUTSIDE_TASK_BODY ;
114          END  CREATE_OPPORTUNITY_TO_CALL ;
115
116
117     BEGIN
118
119          TT.A ( TRUE );
120
121     EXCEPTION
122
123          WHEN  TASKING_ERROR  =>
124               FAILED( "TASKING ERROR" );
125
126     END  ;
127
128     -------------------------------------------------------------------
129
130     RESULT ;
131
132
133END  C97303B ;
134