Ignore:
Timestamp:
May 18, 2020, 4:40:10 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7c38d53
Parents:
893da07
Message:

add -latomic flag to cfa.cc to get 16-byte CAS, add containers/stackLockFree.hfa to Makefile headers, fix flag for detecting int128 in stackLockFree.hfa

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/containers/stackLockFree.hfa

    r893da07 r314dab6  
    99// Created On       : Wed May 13 20:58:58 2020
    1010// Last Modified By : Peter A. Buhr
    11 // Last Modified On : Sun May 17 20:53:37 2020
    12 // Update Count     : 48
     11// Last Modified On : Mon May 18 13:30:08 2020
     12// Update Count     : 55
    1313//
    1414
     
    2323                uintptr_t count;                                                // count each push
    2424        };
    25         #if _GLIBCXX_USE_INT128 == 1
     25        #if __SIZEOF_INT128__ == 16
    2626        __int128                                                                        // gcc, 128-bit integer
    2727        #else
    2828        uint64_t                                                                        // 64-bit integer
    29         #endif // _GLIBCXX_USE_INT128 == 1
     29        #endif // __SIZEOF_INT128__ == 16
    3030        atom;
    3131}; // Link
     
    4444                        for () {                                                                        // busy wait
    4545                                *getNext( &n ) = stack;                                 // atomic assignment unnecessary, or use CAA
    46                                 if ( __atomic_compare_exchange_n( &stack.atom, &getNext( &n )->atom, (Link(T))@{ {&n, getNext( &n )->count + 1} }.atom, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ) break; // attempt to update top node
     46                          if ( __atomic_compare_exchange_n( &stack.atom, &getNext( &n )->atom, (Link(T))@{ {&n, getNext( &n )->count + 1} }.atom, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ) break; // attempt to update top node
    4747                        } // for
    4848                } // push
Note: See TracChangeset for help on using the changeset viewer.