Ignore:
Timestamp:
Jan 5, 2023, 8:48:09 AM (23 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
3d4b7cc7
Parents:
a7662b8 (diff), d99a716 (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

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    ra7662b8 ra14926b  
    215215                struct __thread_user_link cltr_link;
    216216
    217                 // used to store state between clh lock/unlock
    218                 volatile bool * clh_prev;
    219 
    220217                // used to point to this thd's current clh node
    221218                volatile bool * clh_node;
  • libcfa/src/concurrency/locks.hfa

    ra7662b8 ra14926b  
    228228struct clh_lock {
    229229        volatile bool * volatile tail;
     230    volatile bool * volatile head;
    230231};
    231232
     
    237238        *(curr_thd->clh_node) = false;
    238239        volatile bool * prev = __atomic_exchange_n((bool **)(&l.tail), (bool *)(curr_thd->clh_node), __ATOMIC_SEQ_CST);
    239         while(!__atomic_load_n(prev, __ATOMIC_ACQUIRE)) Pause();
    240         curr_thd->clh_prev = prev;
     240        while(!__atomic_load_n(prev, __ATOMIC_SEQ_CST)) Pause();
     241    __atomic_store_n((bool **)(&l.head), (bool *)curr_thd->clh_node, __ATOMIC_SEQ_CST);
     242    curr_thd->clh_node = prev;
    241243}
    242244
    243245static inline void unlock(clh_lock & l) {
    244         thread$ * curr_thd = active_thread();
    245         __atomic_store_n(curr_thd->clh_node, true, __ATOMIC_RELEASE);
    246         curr_thd->clh_node = curr_thd->clh_prev;
     246        __atomic_store_n((bool *)(l.head), true, __ATOMIC_SEQ_CST);
    247247}
    248248
Note: See TracChangeset for help on using the changeset viewer.