4 #define release memory_order_release
5 #define acquire memory_order_acquire
6 #define acq_rel memory_order_acq_rel
7 #define relaxed memory_order_relaxed
11 // This field does not have to be atomic, but in the inference analysis, we
12 // might have a data race for this field without the proper synchronization.
16 node(unsigned int v) {
26 atomic_init(&top, NULL);
29 void push(unsigned int val) {
30 node *n = new node(val);
31 node *old = top.load(relaxed);
34 n->next.store(old, relaxed);
35 } while (!top.compare_exchange_strong(old, n, release, relaxed));
39 node *old = top.load(acquire);
45 n = old->next.load(relaxed);
46 } while (!top.compare_exchange_strong(old, n, relaxed, relaxed));