예제 #1
0
void wait_for_tasks(
    hpx::lcos::local::barrier& finished
  , std::uint64_t suspended_tasks
    )
{
    std::uint64_t const pending_count =
        get_thread_count(hpx::threads::thread_priority_normal
                       , hpx::threads::pending);

    if (pending_count == 0)
    {
        std::uint64_t const all_count =
            get_thread_count(hpx::threads::thread_priority_normal);

        if (all_count != suspended_tasks + 1)
        {
            register_work(hpx::util::bind(&wait_for_tasks
                                    , std::ref(finished)
                                    , suspended_tasks)
                , "wait_for_tasks", hpx::threads::pending
                , hpx::threads::thread_priority_low);
            return;
        }
    }

    finished.wait();
}
예제 #2
0
파일: thread_id.cpp 프로젝트: K-ballo/hpx
void do_nothing(hpx::lcos::local::barrier& b1, hpx::lcos::local::barrier& b2)
{
    b1.wait();
    hpx::this_thread::suspend(100);     // wait for 100 ms
    b2.wait();
}
예제 #3
0
파일: thread.cpp 프로젝트: 41i/hpx
void simple_sync_thread(hpx::lcos::local::barrier& b1, hpx::lcos::local::barrier& b2)
{
    b1.wait();   // wait for both threads to be started
    // ... do nothing
    b2.wait();   // wait for the tests to be completed
}