Changeset 9019b14 for libcfa


Ignore:
Timestamp:
Jun 14, 2020, 3:00:31 PM (4 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:
016b1eb, fb19194
Parents:
79aae15
Message:

make "top" pointer volatile to prevent code movement

File:
1 edited

Legend:

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

    r79aae15 r9019b14  
    99// Created On       : Wed May 13 20:58:58 2020
    1010// Last Modified By : Peter A. Buhr
    11 // Last Modified On : Sat Jun 13 12:24:37 2020
    12 // Update Count     : 62
     11// Last Modified On : Sun Jun 14 13:25:09 2020
     12// Update Count     : 64
    1313//
    1414
     
    2020union Link {
    2121        struct {                                                                                        // 32/64-bit x 2
    22                 T * top;                                                                                // pointer to stack top
     22                T * volatile top;                                                               // pointer to stack top
    2323                uintptr_t count;                                                                // count each push
    2424        };
     
    4949
    5050                T * pop( StackLF(T) & this ) with(this) {
    51                         Link(T) t @= {};
    52                         t = stack;                                                                      // atomic assignment unnecessary, or use CAA
     51                        Link(T) t @= stack;                                                     // atomic assignment unnecessary, or use CAA
    5352                        for () {                                                                        // busy wait
    5453                          if ( t.top == 0p ) return 0p;                         // empty stack ?
Note: See TracChangeset for help on using the changeset viewer.