Beispiel #1
0
 void wait_without_predicate()
 {
     boost::unique_lock<hpx::lcos::local::spinlock> lock(mutex);
     while(!flag)
     {
         cond_var.wait(lock);
     }
     ++woken;
 }
Beispiel #2
0
 void wait_with_predicate()
 {
     boost::unique_lock<hpx::lcos::local::spinlock> lock(mutex);
     cond_var.wait(lock,check_flag(flag));
     if(flag)
     {
         ++woken;
     }
 }
    void wait(hpx::lcos::local::spinlock& local_mutex,
        hpx::lcos::local::condition_variable& local_cond_var, bool& running)
    {
        bool first = true;
        while (!flag)
        {
            // signal successful initialization
            if (first)
            {
                {
                    boost::lock_guard<hpx::lcos::local::spinlock> lk(local_mutex);
                    running = true;
                }

                first = false;
                local_cond_var.notify_all();
            }

            boost::unique_lock<hpx::lcos::local::spinlock> lk(mutex);
            cond_var.wait(mutex);
        }
        ++woken;
    }