Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/locks.cfa

    rbe73f30 r848439f  
    7474
    7575void lock( blocking_lock & this ) with( this ) {
    76         $thread * thrd = active_thread();
    7776        lock( lock __cfaabi_dbg_ctx2 );
    78         if ( owner == thrd && !multi_acquisition) {
     77        if ( owner == kernelTLS.this_thread && !multi_acquisition) {
    7978                fprintf(stderr, "A single acquisition lock holder attempted to reacquire the lock resulting in a deadlock."); // Possibly throw instead
    8079                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 );
    8382                wait_count++;
    8483                unlock( lock );
    8584                park( __cfaabi_dbg_ctx );
    86         } else if ( owner == thrd && multi_acquisition ) {
     85        } else if ( owner == kernelTLS.this_thread && multi_acquisition ) {
    8786                recursion_count++;
    8887                unlock( lock );
    8988        } else {
    90                 owner = thrd;
     89                owner = kernelTLS.this_thread;
    9190                recursion_count = 1;
    9291                unlock( lock );
     
    9594
    9695bool try_lock( blocking_lock & this ) with( this ) {
    97         $thread * thrd = active_thread();
    9896        bool ret = false;
    9997        lock( lock __cfaabi_dbg_ctx2 );
    10098        if ( owner == 0p ) {
    101                 owner = thrd;
     99                owner = kernelTLS.this_thread;
    102100                if ( multi_acquisition ) recursion_count = 1;
    103101                ret = true;
    104         } else if ( owner == thrd && multi_acquisition ) {
     102        } else if ( owner == kernelTLS.this_thread && multi_acquisition ) {
    105103                recursion_count++;
    106104                ret = true;
     
    115113                fprintf( stderr, "There was an attempt to release a lock that isn't held" );
    116114                return;
    117         } else if ( strict_owner && owner != active_thread() ) {
     115        } else if ( strict_owner && owner != kernelTLS.this_thread ) {
    118116                fprintf( stderr, "A thread other than the owner attempted to release an owner lock" );
    119117                return;
     
    161159        if ( owner == 0p ){ // no owner implies lock isn't held
    162160                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 ) {
    164162                fprintf( stderr, "A thread other than the owner of a lock passed it to a synchronization lock" );
    165163        } else {
     
    319317
    320318        void wait( synchronization_lock(L) & this ) with(this) {
    321                 info_thread( L ) i = { active_thread() };
     319                info_thread( L ) i = { kernelTLS.this_thread };
    322320                queue_info_thread( this, i );
    323321        }
    324322
    325323        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 };
    327325                queue_info_thread( this, i );
    328326        }
     
    362360
    363361        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 };
    365363                queue_info_thread_unlock( this, l, i );
    366364        }
    367365
    368366        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 };
    370368                queue_info_thread_unlock( this, l, i );
    371369        }
Note: See TracChangeset for help on using the changeset viewer.