void wait_fn( boost::fibers::mutex & mtx, boost::fibers::condition_variable & cond) { std::unique_lock< boost::fibers::mutex > lk( mtx); cond.wait( lk); ++value1; }
void wait_fn( boost::barrier & b, boost::fibers::mutex & mtx, boost::fibers::condition_variable & cond, bool & flag) { b.wait(); std::unique_lock< boost::fibers::mutex > lk( mtx); cond.wait( lk, [&flag](){ return flag; }); ++value; }
void fn1( boost::fibers::mutex & m, boost::fibers::condition_variable & cv) { std::unique_lock< boost::fibers::mutex > lk( m); BOOST_CHECK(test2 == 0); test1 = 1; cv.notify_one(); while (test2 == 0) { cv.wait(lk); } BOOST_CHECK(test2 != 0); }
void fiber_waiter::wait_ready() noexcept { if (gth_thread_type == thread_type::thread) { std::unique_lock<std::mutex> lk(m_thread_mutex); return m_thread_var.wait(lk, [this] { return m_ready.load(std::memory_order_relaxed); }); } else { std::unique_lock<boost::fibers::mutex> lk(m_fiber_mutex); return m_fiber_var.wait(lk, [this] { return m_ready.load(std::memory_order_relaxed); }); } }