source: tests/concurrent/waitfor/else.c @ 5ebb1368

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resnenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 5ebb1368 was 200fcb3, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

add auto newline to sout, change endl to nl

  • Property mode set to 100644
File size: 709 bytes
Line 
1#include <fstream.hfa>
2#include <monitor.hfa>
3
4#include <stdbool.h>
5
6monitor M {};
7
8void notcalled( M & mutex m ) {
9        abort();
10}
11
12void test( M & mutex m ) {
13        int i = 0;
14        sout | "Starting";
15
16        when( false ) waitfor( notcalled, m );
17
18        sout | "Step" | i++;
19
20        waitfor( notcalled, m ); or else {
21                sout | "else called";
22        }
23
24        sout | "Step" | i++;
25
26        when( true ) waitfor( notcalled, m ); or when( true ) else {
27                sout | "else called";
28        }
29
30        sout | "Step" | i++;
31
32        when( false ) waitfor( notcalled, m ); or when( true ) else {
33                sout | "else called";
34        }
35
36        sout | "Step" | i++;
37
38        when( false ) waitfor( notcalled, m ); or when( false ) else {
39                sout | "else called";
40        }
41
42        sout | "Done";
43}
44
45int main() {
46        M m;
47        test(m);
48}
Note: See TracBrowser for help on using the repository browser.