#include #include #include #include #include "bench.h" int argc; char** argv; volatile int go = 0; monitor M {}; M m1, m2; void __attribute__((noinline)) call( M & mutex a1, M & mutex a2 ) {} int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) { go = 1; BENCH( for ( i; n ) { waitfor(call, a1, a2); }, 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(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { T t; return wait(m1, m2); }