- File:
-
- 1 edited
-
src/libcfa/concurrency/monitor.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/monitor.c
rafd550c rb10affd 85 85 // Lock the monitor spinlock 86 86 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 ); 89 88 90 89 __cfaabi_dbg_print_safe( "Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner); … … 135 134 // Lock the monitor spinlock 136 135 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 ); 139 137 140 138 __cfaabi_dbg_print_safe( "Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner); … … 170 168 171 169 // Create the node specific to this wait operation 172 wait_ctx_primed( thrd, 0 )170 wait_ctx_primed( TL_GET( this_thread ), 0 ) 173 171 174 172 // Some one else has the monitor, wait for him to finish and then run … … 181 179 __cfaabi_dbg_print_safe( "Kernel : blocking \n" ); 182 180 183 wait_ctx( thrd, 0 )181 wait_ctx( TL_GET( this_thread ), 0 ) 184 182 this->dtor_node = &waiter; 185 183 … … 201 199 lock( this->lock __cfaabi_dbg_ctx2 ); 202 200 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 ); 206 204 207 205 // Leaving a recursion level, decrement the counter … … 291 289 // Sorts monitors before entering 292 290 void ?{}( monitor_guard_t & this, monitor_desc * m [], __lock_size_t count, fptr_t func ) { 293 thread_desc * thrd = TL_GET( this_thread );294 295 291 // Store current array 296 292 this.m = m; … … 301 297 302 298 // Save previous thread context 303 this.prev = thrd->monitors;299 this.prev = TL_GET( this_thread )->monitors; 304 300 305 301 // Update thread context (needed for conditions) 306 ( thrd->monitors){m, count, func};302 (TL_GET( this_thread )->monitors){m, count, func}; 307 303 308 304 // __cfaabi_dbg_print_safe( "MGUARD : enter %d\n", count); … … 332 328 // Sorts monitors before entering 333 329 void ?{}( monitor_dtor_guard_t & this, monitor_desc * m [], fptr_t func ) { 334 // optimization335 thread_desc * thrd = TL_GET( this_thread );336 337 330 // Store current array 338 331 this.m = *m; 339 332 340 333 // Save previous thread context 341 this.prev = thrd->monitors;334 this.prev = TL_GET( this_thread )->monitors; 342 335 343 336 // Update thread context (needed for conditions) 344 ( thrd->monitors){m, 1, func};337 (TL_GET( this_thread )->monitors){m, 1, func}; 345 338 346 339 __enter_monitor_dtor( this.m, func ); … … 480 473 481 474 // 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 ) 483 476 484 477 //save contexts … … 573 566 574 567 // 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 ); 576 569 577 570 // Save monitor states … … 619 612 620 613 // 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 ); 622 615 623 616 monitor_save; … … 625 618 626 619 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 ) ); 628 621 } 629 622
Note:
See TracChangeset
for help on using the changeset viewer.