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