void wait_fn(
	boost::fibers::mutex & mtx,
	boost::fibers::condition_variable_any & cond) {
	mtx.lock();
	cond.wait( mtx);
	++value;
    mtx.unlock();
}
void thread( unsigned int i, barrier * b) {
    bind_to_processor( i);
    boost::fibers::use_scheduling_algorithm< boost::fibers::algo::shared_work >();
    b->wait();
    lock_type lk( mtx);
    cnd.wait( lk, [](){ return done; });
    BOOST_ASSERT( done);
}
Exemple #3
0
void thread( unsigned int idx, barrier * b) {
    boost::fibers::numa::pin_thread( idx);
    boost::fibers::use_scheduling_algorithm< boost::fibers::algo::shared_work >();
    b->wait();
    lock_type lk( mtx);
    cnd.wait( lk, [](){ return done; });
    BOOST_ASSERT( done);
}
void fn1( boost::fibers::mutex & m, boost::fibers::condition_variable_any & cv) {
    m.lock();
    BOOST_CHECK(test2 == 0);
    test1 = 1;
    cv.notify_one();
    while (test2 == 0) {
        cv.wait(m);
    }
    BOOST_CHECK(test2 != 0);
    m.unlock();
}