Ignore:
File:
1 edited

Legend:

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

    r0d4f954 r0fc447c  
    164164}
    165165
    166 static inline void lock(linear_backoff_then_block_lock & this) with(this) {
     166static inline bool lock(linear_backoff_then_block_lock & this) with(this) {
    167167        // if owner just return
    168         if (active_thread() == owner) return;
     168        if (active_thread() == owner) return true;
    169169        size_t compare_val = 0;
    170170        int spin = spin_start;
     
    172172        for( ;; ) {
    173173                compare_val = 0;
    174                 if (internal_try_lock(this, compare_val)) return;
     174                if (internal_try_lock(this, compare_val)) return true;
    175175                if (2 == compare_val) break;
    176176                for (int i = 0; i < spin; i++) Pause();
     
    179179        }
    180180
    181         if(2 != compare_val && try_lock_contention(this)) return;
     181        if(2 != compare_val && try_lock_contention(this)) return true;
    182182        // block until signalled
    183         while (block(this)) if(try_lock_contention(this)) return;
     183        while (block(this)) if(try_lock_contention(this)) return true;
     184
     185        // this should never be reached as block(this) always returns true
     186        return false;
    184187}
    185188
Note: See TracChangeset for help on using the changeset viewer.