13 #ifndef EIGEN_CXX11_THREADPOOL_BARRIER_H 14 #define EIGEN_CXX11_THREADPOOL_BARRIER_H 20 Barrier(
unsigned int count) : state_(count << 1), notified_(false) {
21 eigen_plain_assert(((count << 1) >> 1) == count);
23 ~Barrier() { eigen_plain_assert((state_ >> 1) == 0); }
26 unsigned int v = state_.fetch_sub(2, std::memory_order_acq_rel) - 2;
31 eigen_plain_assert(((v + 2) & ~1) != 0);
34 std::unique_lock<std::mutex> l(mu_);
35 eigen_plain_assert(!notified_);
41 unsigned int v = state_.fetch_or(1, std::memory_order_acq_rel);
42 if ((v >> 1) == 0)
return;
43 std::unique_lock<std::mutex> l(mu_);
51 std::condition_variable cv_;
52 std::atomic<unsigned int> state_;
61 struct Notification : Barrier {
62 Notification() : Barrier(1){};
67 #endif // EIGEN_CXX11_THREADPOOL_BARRIER_H Namespace containing all symbols from the Eigen library.