コード例 #1
0
ファイル: timed_task_spawn.cpp プロジェクト: ShmuelLevine/hpx
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
}