#include #include #include #include #include "bench.h" volatile int go = 0; condition c; monitor M {}; M m1, m2; void __attribute__((noinline)) call( M & mutex a1, M & mutex a2 ) { signal(c); } int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) { go = 1; BENCH( for ( i; n ) { wait(c); }, result ) printf( "%g\n", result ); go = 0; return 0; } thread T {}; void ^?{}( T & mutex this ) {} void main( T & ) { while(go == 0) { yield(); } while(go == 1) { call(m1, m2); } } int main( int argc, char * argv[] ) { BENCH_START() T t; return wait(m1, m2); } // Local Variables: // // tab-width: 4 // // End: //