Changes in src/tests/monitor.c [cb0e6de:348006f]
- File:
-
- 1 edited
-
src/tests/monitor.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/monitor.c
rcb0e6de r348006f 13 13 } 14 14 15 monitor_desc * get_monitor( global_t * this ) { 16 return &this->m; 15 static global_t global; 16 17 void increment( /*mutex*/ global_t * this ) { 18 monitor_desc * mon = &this->m; 19 monitor_guard_t g1 = { &mon }; 20 { 21 monitor_guard_t g2 = { &mon }; 22 { 23 monitor_guard_t g3 = { &mon }; 24 this->value += 1; 25 } 26 } 17 27 } 18 28 19 static global_t global; 20 21 void increment3( global_t * mutex this ) { 22 this->value += 1; 23 } 24 25 void increment2( global_t * mutex this ) { 26 increment3( this ); 27 } 28 29 void increment( global_t * mutex this ) { 30 increment2( this ); 31 } 32 33 struct MyThread { thread_desc __thrd; }; 29 struct MyThread { thread_desc t; }; 34 30 35 31 DECL_THREAD(MyThread); 36 32 37 33 void ?{}( MyThread * this ) {} 38 void ^?{}( MyThread * mutex this ) {}39 34 40 35 void main( MyThread* this ) { 41 for(int i = 0; i < 1 _000_000; i++) {36 for(int i = 0; i < 1000000; i++) { 42 37 increment( &global ); 43 38 }
Note:
See TracChangeset
for help on using the changeset viewer.