Ignore:
Timestamp:
May 25, 2023, 5:00:06 PM (17 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ast-experimental, master
Children:
a5aa5bf
Parents:
4246869 (diff), bccd70a (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

    r4246869 ra5294af  
    176176static inline void ?{}(mcs_spin_node & this) { this.next = 0p; this.locked = true; }
    177177
    178 static inline mcs_spin_node * volatile & ?`next ( mcs_spin_node * node ) {
    179         return node->next;
    180 }
    181 
    182178struct mcs_spin_lock {
    183179        mcs_spin_queue queue;
     
    185181
    186182static inline void lock(mcs_spin_lock & l, mcs_spin_node & n) {
     183    n.locked = true;
    187184        mcs_spin_node * prev = __atomic_exchange_n(&l.queue.tail, &n, __ATOMIC_SEQ_CST);
    188         n.locked = true;
    189         if(prev == 0p) return;
     185        if( prev == 0p ) return;
    190186        prev->next = &n;
    191         while(__atomic_load_n(&n.locked, __ATOMIC_RELAXED)) Pause();
     187        while( __atomic_load_n(&n.locked, __ATOMIC_RELAXED) ) Pause();
    192188}
    193189
     
    195191        mcs_spin_node * n_ptr = &n;
    196192        if (__atomic_compare_exchange_n(&l.queue.tail, &n_ptr, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) return;
    197         while (__atomic_load_n(&n.next, __ATOMIC_RELAXED) == 0p) {}
     193        while (__atomic_load_n(&n.next, __ATOMIC_RELAXED) == 0p) Pause();
    198194        n.next->locked = false;
    199195}
Note: See TracChangeset for help on using the changeset viewer.