Changeset 02c5880 for libcfa


Ignore:
Timestamp:
Oct 12, 2023, 4:03:38 PM (7 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
80f8703
Parents:
4604bf5
Message:

Added fence after channel handoff to prevent reordering on the arm that resulted in stale values

File:
1 edited

Legend:

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

    r4604bf5 r02c5880  
    130130static inline void __cons_handoff( channel(T) & chan, T & elem ) with(chan) {
    131131    memcpy( cons`first.extra, (void *)&elem, sizeof(T) ); // do waiting consumer work
     132    __atomic_thread_fence( __ATOMIC_SEQ_CST );
    132133    wake_one( cons );
    133134}
     
    136137static inline void __prods_handoff( channel(T) & chan, T & retval ) with(chan) {
    137138    memcpy( (void *)&retval, prods`first.extra, sizeof(T) );
     139    __atomic_thread_fence( __ATOMIC_SEQ_CST );
    138140    wake_one( prods );
    139141}
Note: See TracChangeset for help on using the changeset viewer.