1-- C97301E.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 DELAYS FOR AT LEAST THE SPECIFIED
26-- AMOUNT OF TIME IF A RENDEZVOUS IS NOT POSSIBLE.
27
28-- CASE  E:  THE BODY OF THE TASK CONTAINING THE CALLED ENTRY
29--           DOES NOT CONTAIN AN ACCEPT_STATEMENT FOR THAT ENTRY  -
30--           (THE ENTRY BELONGS TO AN ENTRY FAMILY; SOME FAMILY MEMBERS
31--           ARE "ACCEPTABLE", BUT NOT THE CALLED ONE.)
32
33-- RJW 3/31/86
34
35with Impdef;
36WITH REPORT; USE REPORT;
37WITH CALENDAR; USE CALENDAR;
38PROCEDURE C97301E IS
39
40     OR_BRANCH_TAKEN : BOOLEAN := FALSE;
41
42BEGIN
43
44     TEST ("C97301E", "CHECK THAT A TIMED_ENTRY_CALL DELAYS FOR AT " &
45                      "LEAST THE SPECIFIED AMOUNT OF TIME " &
46                      "IN THE ABSENCE OF A CORRESPONDING " &
47                      "ACCEPT_STATEMENT " );
48
49     DECLARE
50
51          WAIT_TIME : DURATION :=  3.0 * Impdef.One_Second;
52
53          START_TIME : TIME;
54
55          STOP_TIME : TIME;
56
57          SUBTYPE  SHORT  IS  INTEGER RANGE 10..20 ;
58
59          KEEP_ALIVE  :  INTEGER  := 15 ;
60
61          TASK  T  IS
62               ENTRY  DO_IT_NOW_OR_WAIT ( SHORT ) ;
63          END  T ;
64
65          TASK BODY  T  IS
66          BEGIN
67
68               -- NO ACCEPT_STATEMENT FOR THE ENTRY_CALL BEING TESTED.
69               ACCEPT  DO_IT_NOW_OR_WAIT ( IDENT_INT(15) );
70
71                                     -- THIS ALSO PREVENTS THIS SERVER
72                                     --     TASK FROM TERMINATING IF
73                                     --     UPON ACTIVATION
74                                     --     IT GETS TO RUN
75                                     --     AHEAD OF THE CALLER (WHICH
76                                     --     WOULD LEAD TO A SUBSEQUENT
77                                     --     TASKING_ERROR AT THE TIME
78                                     --     OF THE NO-WAIT CALL).
79
80          END ;
81
82
83     BEGIN
84          START_TIME := CLOCK;
85          SELECT
86               T.DO_IT_NOW_OR_WAIT (10) ;  -- ACCEPT_STATEMENT HAS 15.
87          OR
88                            --   THEREFORE THIS BRANCH MUST BE CHOSEN.
89               DELAY WAIT_TIME;
90               STOP_TIME := CLOCK;
91               IF STOP_TIME >= (WAIT_TIME + START_TIME) THEN
92                    NULL;
93               ELSE
94                    FAILED ( "INSUFFICIENT DELAY" );
95               END IF;
96               OR_BRANCH_TAKEN := TRUE ;
97               COMMENT( "OR_BRANCH TAKEN" );
98          END SELECT;
99
100          T.DO_IT_NOW_OR_WAIT (KEEP_ALIVE) ;
101
102     EXCEPTION
103          WHEN TASKING_ERROR =>
104               FAILED ( "TASKING ERROR" );
105
106     END;   -- END OF BLOCK CONTAINING THE TIMED ENTRY CALL.
107
108     -- BY NOW, TASK T IS TERMINATED.
109
110     IF  OR_BRANCH_TAKEN  THEN
111          NULL ;
112     ELSE
113          FAILED( "RENDEZVOUS ATTEMPTED" );
114     END IF;
115
116     RESULT;
117
118END  C97301E ;
119