1-- C93004B.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 WHEN AN EXCEPTION IS RAISED DURING THE ACTIVATION OF A
26-- TASK, OTHER TASKS ARE UNAFFECTED.
27
28-- THE ENCLOSING BLOCK RECEIVES TASKING_ERROR.
29
30-- CHECK THAT TASKS WAITING ON ENTRIES OF SUCH TASKS RECEIVE
31-- TASKING_ERROR
32
33-- JEAN-PIERRE ROSEN 09-MAR-1984
34-- JBG 06/01/84
35-- JBG 05/23/85
36-- EG  10/29/85 ELIMINATE THE USE OF NUMERIC_ERROR IN TEST.
37-- PWN 11/30/94 REMOVED PRAGMA PRIORITY INSTANCES FOR ADA 9X.
38
39WITH REPORT; USE REPORT;
40WITH SYSTEM; USE SYSTEM;
41PROCEDURE C93004B IS
42
43BEGIN
44     TEST("C93004B", "EXCEPTIONS DURING ACTIVATION");
45
46     DECLARE
47
48          TASK TYPE T1 IS
49          END T1;
50
51          TASK TYPE T2 IS
52               ENTRY E;
53          END T2;
54
55          ARR_T2: ARRAY(INTEGER RANGE 1..1) OF T2;
56
57          TYPE AT1 IS ACCESS T1;
58
59          PACKAGE START_T1 IS  -- THIS PACKAGE TO AVOID ACCESS BEFORE
60          END START_T1;        -- ELABORATION ON T1.
61
62          TASK BODY T1 IS
63          BEGIN
64               DECLARE    -- THIS BLOCK TO CHECK THAT T1BIS TERMINATES.
65                    TASK T1BIS IS
66                    END T1BIS;
67
68                    TASK BODY T1BIS IS
69                    BEGIN
70                         ARR_T2(IDENT_INT(1)).E;
71                         FAILED ("RENDEZVOUS COMPLETED - T1BIS");
72                    EXCEPTION
73                         WHEN TASKING_ERROR =>
74                              NULL;
75                         WHEN OTHERS =>
76                              FAILED("ABNORMAL EXCEPTION - T1BIS");
77                    END T1BIS;
78               BEGIN
79                    NULL;
80               END;
81
82               ARR_T2(IDENT_INT(1)).E;  -- ARR_T2(1) IS NOW TERMINATED.
83
84               FAILED ("RENDEZVOUS COMPLETED WITHOUT ERROR - T1");
85
86          EXCEPTION
87               WHEN TASKING_ERROR =>
88                    NULL;
89               WHEN OTHERS =>
90                    FAILED("ABNORMAL EXCEPTION - T1");
91          END;
92
93          PACKAGE BODY START_T1 IS
94               V_AT1 : AT1 := NEW T1;
95          END START_T1;
96
97          TASK BODY T2 IS
98               I : POSITIVE := IDENT_INT(0); -- RAISE CONSTRAINT_ERROR.
99          BEGIN
100               IF I /= IDENT_INT(2) OR I = IDENT_INT(1) + 1 THEN
101                    FAILED("T2 ACTIVATED OK");
102               END IF;
103          END T2;
104
105          TASK T3 IS
106               ENTRY E;
107          END T3;
108
109          TASK BODY T3 IS
110          BEGIN     -- T3 MUST BE ACTIVATED OK.
111               ACCEPT E;
112          END T3;
113
114     BEGIN
115          FAILED ("TASKING_ERROR NOT RAISED IN MAIN");
116          T3.E;          -- CLEAN UP.
117     EXCEPTION
118          WHEN TASKING_ERROR =>
119               BEGIN
120                    T3.E;
121               EXCEPTION
122                    WHEN TASKING_ERROR =>
123                         FAILED ("T3 NOT ACTIVATED");
124               END;
125          WHEN CONSTRAINT_ERROR =>
126               FAILED ("CONSTRAINT_ERROR RAISED IN MAIN");
127          WHEN OTHERS =>
128               FAILED ("ABNORMAL EXCEPTION IN MAIN-2");
129     END;
130
131     RESULT;
132END C93004B;
133