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