#include #include #include #include struct global_t { int value; monitor_desc m; }; void ?{}(global_t * this) { this->value = 0; } monitor_desc * get_monitor( global_t * this ) { return &this->m; } static global_t global; void increment3( global_t * mutex this ) { this->value += 1; } void increment2( global_t * mutex this ) { increment3( this ); } void increment( global_t * mutex this ) { increment2( this ); } struct MyThread { thread_desc __thrd; }; DECL_THREAD(MyThread); void ?{}( MyThread * this ) {} void ^?{}( MyThread * mutex this ) {} void main( MyThread* this ) { for(int i = 0; i < 1_000_000; i++) { increment( &global ); } } int main(int argc, char* argv[]) { assert( global.m.entry_queue.tail != NULL ); processor p; { scoped(MyThread) f[4]; } sout | global.value | endl; }