- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.cfa
rbe73f30 r848439f 74 74 75 75 void lock( blocking_lock & this ) with( this ) { 76 $thread * thrd = active_thread();77 76 lock( lock __cfaabi_dbg_ctx2 ); 78 if ( owner == thrd && !multi_acquisition) {77 if ( owner == kernelTLS.this_thread && !multi_acquisition) { 79 78 fprintf(stderr, "A single acquisition lock holder attempted to reacquire the lock resulting in a deadlock."); // Possibly throw instead 80 79 exit(EXIT_FAILURE); 81 } else if ( owner != 0p && owner != thrd ) {82 append( blocked_threads, thrd );80 } else if ( owner != 0p && owner != kernelTLS.this_thread ) { 81 append( blocked_threads, kernelTLS.this_thread ); 83 82 wait_count++; 84 83 unlock( lock ); 85 84 park( __cfaabi_dbg_ctx ); 86 } else if ( owner == thrd && multi_acquisition ) {85 } else if ( owner == kernelTLS.this_thread && multi_acquisition ) { 87 86 recursion_count++; 88 87 unlock( lock ); 89 88 } else { 90 owner = thrd;89 owner = kernelTLS.this_thread; 91 90 recursion_count = 1; 92 91 unlock( lock ); … … 95 94 96 95 bool try_lock( blocking_lock & this ) with( this ) { 97 $thread * thrd = active_thread();98 96 bool ret = false; 99 97 lock( lock __cfaabi_dbg_ctx2 ); 100 98 if ( owner == 0p ) { 101 owner = thrd;99 owner = kernelTLS.this_thread; 102 100 if ( multi_acquisition ) recursion_count = 1; 103 101 ret = true; 104 } else if ( owner == thrd && multi_acquisition ) {102 } else if ( owner == kernelTLS.this_thread && multi_acquisition ) { 105 103 recursion_count++; 106 104 ret = true; … … 115 113 fprintf( stderr, "There was an attempt to release a lock that isn't held" ); 116 114 return; 117 } else if ( strict_owner && owner != active_thread()) {115 } else if ( strict_owner && owner != kernelTLS.this_thread ) { 118 116 fprintf( stderr, "A thread other than the owner attempted to release an owner lock" ); 119 117 return; … … 161 159 if ( owner == 0p ){ // no owner implies lock isn't held 162 160 fprintf( stderr, "A lock that is not held was passed to a synchronization lock" ); 163 } else if ( strict_owner && owner != active_thread()) {161 } else if ( strict_owner && owner != kernelTLS.this_thread ) { 164 162 fprintf( stderr, "A thread other than the owner of a lock passed it to a synchronization lock" ); 165 163 } else { … … 319 317 320 318 void wait( synchronization_lock(L) & this ) with(this) { 321 info_thread( L ) i = { active_thread()};319 info_thread( L ) i = { kernelTLS.this_thread }; 322 320 queue_info_thread( this, i ); 323 321 } 324 322 325 323 void wait( synchronization_lock(L) & this, uintptr_t info ) with(this) { 326 info_thread( L ) i = { active_thread(), info };324 info_thread( L ) i = { kernelTLS.this_thread, info }; 327 325 queue_info_thread( this, i ); 328 326 } … … 362 360 363 361 void wait( synchronization_lock(L) & this, L & l ) with(this) { 364 info_thread(L) i = { active_thread()};362 info_thread(L) i = { kernelTLS.this_thread }; 365 363 queue_info_thread_unlock( this, l, i ); 366 364 } 367 365 368 366 void wait( synchronization_lock(L) & this, L & l, uintptr_t info ) with(this) { 369 info_thread(L) i = { active_thread(), info };367 info_thread(L) i = { kernelTLS.this_thread, info }; 370 368 queue_info_thread_unlock( this, l, i ); 371 369 }
Note: See TracChangeset
for help on using the changeset viewer.