source: tests/concurrent/waitfor/parse.cfa @ 66812dd

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 66812dd was cca568e, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

change all example waitfor statements from comma separate to colon

  • Property mode set to 100644
File size: 1.7 KB
Line 
1//----------------------------------------------------------------------------------------
2//----------------------------------------------------------------------------------------
3//
4//              DEPRECATED TEST
5//              DIFFERS BETWEEN DEBUG AND RELEASE
6//
7//----------------------------------------------------------------------------------------
8//----------------------------------------------------------------------------------------
9
10#include <monitor.hfa>
11
12monitor M {};
13
14M a;
15
16void f1( M & mutex a );
17void f2( M & mutex a );
18void f2( M & mutex a, M & mutex b );
19void f3( M & mutex a );
20void f3( M & mutex a, M & mutex b );
21void f3( M & mutex a, M & mutex b, M & mutex c );
22
23void foo() {
24
25        //---------------------------------------
26        waitfor( f1 : a ) {
27                1;
28        }
29
30        //---------------------------------------
31        waitfor( f1 : a ) {
32                2;
33        }
34        waitfor( f2 : a ) {
35                3;
36        }
37
38        //---------------------------------------
39        when( 1 < 3 ) waitfor( f2 : a, a ) {
40                4;
41        }
42        or timeout( 100 ) {
43                5;
44        }
45
46        //---------------------------------------
47        when( 2 < 3 ) waitfor( f3 : a ) {
48                5;
49        }
50        or else {
51                6;
52        }
53
54        //---------------------------------------
55        when( 3 < 3 ) waitfor( f3 : a, a ) {
56                7;
57        }
58        or when( 4 < 3 ) timeout( 101 ) {
59                8;
60        }
61        or when( 5 < 3 ) else {
62                9;
63        }
64
65        //---------------------------------------
66        when( 6 < 3 ) waitfor( f3 : a, a, a ) {
67                10;
68        }
69        or when( 7 < 3 ) waitfor( f1 : a  ) {
70                11;
71        }
72        or else {
73                12;
74        }
75
76        //---------------------------------------
77        when( 8 < 3 ) waitfor( f3 : a, a ) {
78                13;
79        }
80        or waitfor( f1 : a  ) {
81                14;
82        }
83        or when( 9 < 3 ) timeout( 102 ) {
84                15;
85        }
86
87        //---------------------------------------
88        when( 10 < 3 ) waitfor( f1 : a ) {
89                16;
90        }
91        or waitfor( f2 : a, a ) {
92                17;
93        }
94        or timeout( 103 ) {
95                18;
96        }
97        or when( 11 < 3 ) else {
98                19;
99        }
100}
101
102int main() {}
Note: See TracBrowser for help on using the repository browser.