예제 #1
0
파일: wait_some.hpp 프로젝트: 7ev3n/hpx
            void operator()()
            {
                // set callback functions to executed wait future is ready
                set_on_completed_callback(*this);

                // if all of the requested futures are already set, our
                // callback above has already been called often enough, otherwise
                // we suspend ourselves
                if (!goal_reached_on_calling_thread_)
                {
                    // wait for any of the futures to return to become ready
                    this_thread::suspend(threads::suspended,
                        "hpx::detail::wait_some::operator()");
                }

                // at least N futures should be ready
                HPX_ASSERT(count_.load(boost::memory_order_seq_cst) >= needed_count_);
            }
예제 #2
0
파일: when_each.hpp 프로젝트: Titzi90/hpx
            result_type operator()()
            {
                count_.store(0);
                goal_reached_on_calling_thread_ = false;

                // set callback functions to executed when future is ready
                set_on_completed_callback(this->shared_from_this());

                // If all of the requested futures are already set then our
                // callback above has already been called, otherwise we suspend
                // ourselves.
                if (!goal_reached_on_calling_thread_)
                {
                    // wait for all of the futures to return to become ready
                    this_thread::suspend(threads::suspended,
                        "hpx::lcos::detail::when_each::operator()");
                }

                // all futures should be ready
                HPX_ASSERT(count_.load(boost::memory_order_seq_cst) == needed_count_);
            }
예제 #3
0
파일: wait_n.hpp 프로젝트: eile/hpx
            result_type operator()()
            {
                // set callback functions to executed wait future is ready
                set_on_completed_callback(*this,
                    util::bind(
                        &wait_n::on_future_ready, this->shared_from_this(),
                        threads::get_self_id()));

                // if all of the requested futures are already set, our
                // callback above has already been called often enough, otherwise
                // we suspend ourselves
                if (count_.load(boost::memory_order_acquire) < needed_count_)
                {
                    // wait for any of the futures to return to become ready
                    this_thread::suspend(threads::suspended,
                        "hpx::detail::when_n::operator()");
                }

                // at least N futures should be ready
                HPX_ASSERT(count_.load(boost::memory_order_acquire) >= needed_count_);
            }