source: benchmark/schedext/cfa1.cfa @ 96f5b30

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since 96f5b30 was cca568e, checked in by Peter A. Buhr <pabuhr@…>, 23 months ago

change all example waitfor statements from comma separate to colon

  • Property mode set to 100644
File size: 646 bytes
Line 
1#include <kernel.hfa>
2#include <monitor.hfa>
3#include <thread.hfa>
4#include <stdio.h>
5
6#include "bench.h"
7
8volatile int go = 0;
9
10monitor M {};
11M m1;
12
13void __attribute__((noinline)) call( M & mutex a1 ) {}
14
15int  __attribute__((noinline)) wait( M & mutex a1 ) {
16        go = 1;
17        for ( i; times ) {
18                waitfor(call : a1);
19        }
20        go = 0;
21        return 0;
22}
23
24thread T {};
25void ^?{}( T & mutex this ) {}
26void main( T & ) {
27        while(go == 0) { yield(); }
28        BENCH(
29                while(go == 1) { call(m1); },
30                result
31        )
32        printf( "%g\n", result );
33}
34
35int main( int argc, char * argv[] ) {
36        BENCH_START()
37        T t;
38        return wait( m1 );
39}
40
41// Local Variables: //
42// tab-width: 4 //
43// End: //
Note: See TracBrowser for help on using the repository browser.