1 #ifndef _SPINBARRIER_H_
2 #define _SPINBARRIER_H_
9 * Barrier implemented by spinning
14 spin_barrier(size_t n)
20 spin_barrier(const spin_barrier &) = delete;
21 spin_barrier(spin_barrier &&) = delete;
22 spin_barrier &operator=(const spin_barrier &) = delete;
26 ALWAYS_ASSERT(n == 0);
32 // written like this (instead of using __sync_fetch_and_add())
33 // so we can have assertions
36 ALWAYS_ASSERT(copy > 0);
37 if (__sync_bool_compare_and_swap(&n, copy, copy - 1))
53 #endif /* _SPINBARRIER_H_ */