10 #ifndef EIGEN_CXX11_THREADPOOL_EVENTCOUNT_H_ 11 #define EIGEN_CXX11_THREADPOOL_EVENTCOUNT_H_ 72 if (
state_.compare_exchange_weak(state, newstate,
73 std::memory_order_seq_cst))
94 std::memory_order_relaxed);
98 std::memory_order_acq_rel)) {
99 if ((
state & kSignalMask) == 0) {
122 if (
state_.compare_exchange_weak(state, newstate,
123 std::memory_order_acq_rel))
131 std::atomic_thread_fence(std::memory_order_seq_cst);
138 if ((state &
kStackMask) == kStackMask && waiters == signals)
return;
144 }
else if (signals < waiters) {
150 uint64_t next = w->next.load(std::memory_order_relaxed);
154 if (
state_.compare_exchange_weak(state, newstate,
155 std::memory_order_acq_rel)) {
156 if (!notifyAll && (signals < waiters))
158 if ((state & kStackMask) ==
kStackMask)
return;
160 if (!notifyAll) w->next.store(kStackMask, std::memory_order_relaxed);
210 static_assert(kEpochBits >= 20,
"not enough bits to prevent ABA problem");
221 std::unique_lock<std::mutex> lock(w->
mu);
229 for (
Waiter* next;
w; w = next) {
231 next = wnext == kStackMask ? nullptr : &waiters_[wnext];
234 std::unique_lock<std::mutex> lock(w->
mu);
249 #endif // EIGEN_CXX11_THREADPOOL_EVENTCOUNT_H_ static const uint64_t kSignalShift
std::condition_variable cv
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t size() const
static const uint64_t kSignalInc
EventCount(MaxSizeVector< Waiter > &waiters)
static const uint64_t kEpochMask
Namespace containing all symbols from the Eigen library.
static void CheckState(uint64_t state, bool waiter=false)
static const uint64_t kEpochShift
static const uint64_t kWaiterMask
void operator=(const EventCount &)=delete
MaxSizeVector< Waiter > & waiters_
static const uint64_t kSignalMask
static const uint64_t kStackMask
EIGEN_ALIGN_TO_BOUNDARY(128) std std::mutex mu
static const uint64_t kWaiterBits
std::atomic< uint64_t > state_
unsigned __int64 uint64_t
#define eigen_plain_assert(x)
static const uint64_t kWaiterShift
void Notify(bool notifyAll)
static const uint64_t kEpochBits
static const uint64_t kWaiterInc
static const uint64_t kEpochInc
void CommitWait(Waiter *w)