Ignore:
Timestamp:
Jul 25, 2022, 2:23:28 PM (3 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
4c48be0, 5cf1228, def751f
Parents:
9e23b446 (diff), 1f950c3b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r9e23b446 rffec1bf  
    478478        #endif
    479479        lock( lock, node );
    480         while(held) Pause();
    481         held = true;
    482         // printf("locked\n");
     480        while(__atomic_load_n(&held, __ATOMIC_SEQ_CST)) Pause();
     481        __atomic_store_n(&held, true, __ATOMIC_SEQ_CST);
    483482        unlock( lock, node );
    484483        #ifdef __CFA_DEBUG__
     
    488487
    489488static inline void unlock(spin_queue_lock & this) with(this) {
    490         // printf("unlocked\n");
    491489        #ifdef __CFA_DEBUG__
    492490        owner = 0p;
    493491        #endif
    494         held = false;
     492        __atomic_store_n(&held, false, __ATOMIC_RELEASE);
    495493}
    496494
     
    535533        #endif
    536534        lock( lock, node );
    537         while(held) Pause();
    538         held = true;
     535        while(__atomic_load_n(&held, __ATOMIC_SEQ_CST)) Pause();
     536        __atomic_store_n(&held, true, __ATOMIC_SEQ_CST);
    539537        unlock( lock, node );
    540538        #ifdef __CFA_DEBUG__
     
    547545        owner = 0p;
    548546        #endif
    549         held = false;
     547        __atomic_store_n(&held, false, __ATOMIC_SEQ_CST);
    550548}
    551549
     
    588586        #endif
    589587        lock( lock );
    590         while(held) Pause();
    591         held = true;
     588        while(__atomic_load_n(&held, __ATOMIC_SEQ_CST)) Pause();
     589        __atomic_store_n(&held, true, __ATOMIC_RELEASE);
    592590        unlock( lock );
    593591        #ifdef __CFA_DEBUG__
     
    600598        owner = 0p;
    601599        #endif
    602         held = false;
     600        __atomic_store_n(&held, false, __ATOMIC_RELEASE);
    603601}
    604602
Note: See TracChangeset for help on using the changeset viewer.