Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/monitor.c

    rcb0e6de r348006f  
    1313}
    1414
    15 monitor_desc * get_monitor( global_t * this ) {
    16         return &this->m;
     15static global_t global;
     16
     17void 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        }
    1727}
    1828
    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; };
     29struct MyThread { thread_desc t; };
    3430
    3531DECL_THREAD(MyThread);
    3632
    3733void ?{}( MyThread * this ) {}
    38 void ^?{}( MyThread * mutex this ) {}
    3934
    4035void main( MyThread* this ) {
    41         for(int i = 0; i < 1_000_000; i++) {
     36        for(int i = 0; i < 1000000; i++) {
    4237                increment( &global );
    4338        }
Note: See TracChangeset for help on using the changeset viewer.