Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/monitor.c

    rafd550c rb10affd  
    8585                // Lock the monitor spinlock
    8686                lock( this->lock __cfaabi_dbg_ctx2 );
    87                 // Interrupts disable inside critical section
    88                 thread_desc * thrd = kernelTLS.this_thread;
     87                thread_desc * thrd = TL_GET( this_thread );
    8988
    9089                __cfaabi_dbg_print_safe( "Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);
     
    135134                // Lock the monitor spinlock
    136135                lock( this->lock __cfaabi_dbg_ctx2 );
    137                 // Interrupts disable inside critical section
    138                 thread_desc * thrd = kernelTLS.this_thread;
     136                thread_desc * thrd = TL_GET( this_thread );
    139137
    140138                __cfaabi_dbg_print_safe( "Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner);
     
    170168
    171169                        // Create the node specific to this wait operation
    172                         wait_ctx_primed( thrd, 0 )
     170                        wait_ctx_primed( TL_GET( this_thread ), 0 )
    173171
    174172                        // Some one else has the monitor, wait for him to finish and then run
     
    181179                        __cfaabi_dbg_print_safe( "Kernel :  blocking \n" );
    182180
    183                         wait_ctx( thrd, 0 )
     181                        wait_ctx( TL_GET( this_thread ), 0 )
    184182                        this->dtor_node = &waiter;
    185183
     
    201199                lock( this->lock __cfaabi_dbg_ctx2 );
    202200
    203                 __cfaabi_dbg_print_safe( "Kernel : %10p Leaving mon %p (%p)\n", kernelTLS.this_thread, this, this->owner);
    204 
    205                 verifyf( kernelTLS.this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, this->owner, this->recursion, this );
     201                __cfaabi_dbg_print_safe( "Kernel : %10p Leaving mon %p (%p)\n", TL_GET( this_thread ), this, this->owner);
     202
     203                verifyf( TL_GET( this_thread ) == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", TL_GET( this_thread ), this->owner, this->recursion, this );
    206204
    207205                // Leaving a recursion level, decrement the counter
     
    291289// Sorts monitors before entering
    292290void ?{}( monitor_guard_t & this, monitor_desc * m [], __lock_size_t count, fptr_t func ) {
    293         thread_desc * thrd = TL_GET( this_thread );
    294 
    295291        // Store current array
    296292        this.m = m;
     
    301297
    302298        // Save previous thread context
    303         this.prev = thrd->monitors;
     299        this.prev = TL_GET( this_thread )->monitors;
    304300
    305301        // Update thread context (needed for conditions)
    306         (thrd->monitors){m, count, func};
     302        (TL_GET( this_thread )->monitors){m, count, func};
    307303
    308304        // __cfaabi_dbg_print_safe( "MGUARD : enter %d\n", count);
     
    332328// Sorts monitors before entering
    333329void ?{}( monitor_dtor_guard_t & this, monitor_desc * m [], fptr_t func ) {
    334         // optimization
    335         thread_desc * thrd = TL_GET( this_thread );
    336 
    337330        // Store current array
    338331        this.m = *m;
    339332
    340333        // Save previous thread context
    341         this.prev = thrd->monitors;
     334        this.prev = TL_GET( this_thread )->monitors;
    342335
    343336        // Update thread context (needed for conditions)
    344         (thrd->monitors){m, 1, func};
     337        (TL_GET( this_thread )->monitors){m, 1, func};
    345338
    346339        __enter_monitor_dtor( this.m, func );
     
    480473
    481474        // Create the node specific to this wait operation
    482         wait_ctx_primed( kernelTLS.this_thread, 0 )
     475        wait_ctx_primed( TL_GET( this_thread ), 0 )
    483476
    484477        //save contexts
     
    573566
    574567                                // Create the node specific to this wait operation
    575                                 wait_ctx_primed( kernelTLS.this_thread, 0 );
     568                                wait_ctx_primed( TL_GET( this_thread ), 0 );
    576569
    577570                                // Save monitor states
     
    619612
    620613        // Create the node specific to this wait operation
    621         wait_ctx_primed( kernelTLS.this_thread, 0 );
     614        wait_ctx_primed( TL_GET( this_thread ), 0 );
    622615
    623616        monitor_save;
     
    625618
    626619        for( __lock_size_t i = 0; i < count; i++) {
    627                 verify( monitors[i]->owner == kernelTLS.this_thread );
     620                verify( monitors[i]->owner == TL_GET( this_thread ) );
    628621        }
    629622
Note: See TracChangeset for help on using the changeset viewer.