Exemplo n.º 1
0
    void abort_pending(error ec)
    { // {{{
        mutex_type::scoped_lock l(mtx_);

        LLCO_(info)
            << "object_semaphore::abort_pending: thread_queue is not empty, "
               "aborting threads";

        while (!thread_queue_.empty())
        {
            naming::id_type id = thread_queue_.front().id_;
            thread_queue_.front().id_ = naming::invalid_id;
            thread_queue_.pop_front();

            LLCO_(info)
                << "object_semaphore::abort_pending: pending thread " << id;

            try
            {
                HPX_THROW_EXCEPTION(ec, "object_semaphore::abort_pending",
                    "aborting pending thread");
            }

            catch (hpx::exception const& /*e*/)
            {
                applier::trigger_error(id, boost::current_exception());
            }
        }

        BOOST_ASSERT(thread_queue_.empty());
    } // }}}
 packaged_action(naming::id_type const& gid,
         HPX_ENUM_FWD_ARGS(N, Arg, arg))
   : apply_logger_("packaged_action_direct::apply")
 {
     LLCO_(info) << "packaged_action::packaged_action("
                 << hpx::actions::detail::get_action_name<action_type>()
                 << ", "
                 << gid
                 << ") args(" << (N + 1) << ")";
     apply(launch::all, gid, HPX_ENUM_FORWARD_ARGS(N, Arg, arg));
 }
Exemplo n.º 3
0
    void continuation::trigger_error(boost::exception_ptr && e) const //-V659
    {
        if (!gid_) {
            HPX_THROW_EXCEPTION(invalid_status,
                "continuation::trigger_error",
                "attempt to trigger invalid LCO (the id is invalid)");
            return;
        }

        LLCO_(info) << "continuation::trigger_error(" << gid_ << ")";
        set_lco_error(gid_, std::move(e));
    }
Exemplo n.º 4
0
    void continuation::trigger() const
    {
        if (!gid_) {
            HPX_THROW_EXCEPTION(invalid_status,
                "continuation::trigger",
                "attempt to trigger invalid LCO (the id is invalid)");
            return;
        }

        LLCO_(info) << "continuation::trigger(" << gid_ << ")";
        trigger_lco_event(gid_);
    }
Exemplo n.º 5
0
 packaged_action(naming::gid_type const& gid,
         threads::thread_priority priority,
         HPX_ENUM_FWD_ARGS(N, Arg, arg))
   : apply_logger_("packaged_action::apply")
 {
     LLCO_(info) << "packaged_action::packaged_action("
                 << hpx::actions::detail::get_action_name<action_type>()
                 << ", "
                 << gid
                 << ") args(" << (N + 1) << ")";
     apply_p(naming::id_type(gid, naming::id_type::unmanaged),
         priority, HPX_ENUM_FORWARD_ARGS(N, Arg, arg));
 }
Exemplo n.º 6
0
 packaged_action(naming::id_type const& gid,
         completed_callback_type const& data_sink,
         HPX_ENUM_FWD_ARGS(N, Arg, arg))
   : base_type(data_sink),
     apply_logger_("packaged_action::apply")
 {
     LLCO_(info) << "packaged_action::packaged_action("
                 << hpx::actions::detail::get_action_name<action_type>()
                 << ", "
                 << gid
                 << ") args(" << (N + 1) << ")";
     apply(gid, HPX_ENUM_FORWARD_ARGS(N, Arg, arg));
 }
Exemplo n.º 7
0
 void operator()(
     naming::id_type const & cont
   , naming::id_type const & id
   , Vector & args
 ) const
 {
     LLCO_(info)
         << "dataflow apply action "
         << hpx::actions::detail::get_action_name<Action>();
     hpx::apply_c<Action>(
         cont
       , id
       , boost::move(boost::fusion::at_c< 0>(args)) , boost::move(boost::fusion::at_c< 1>(args)) , boost::move(boost::fusion::at_c< 2>(args)) , boost::move(boost::fusion::at_c< 3>(args)) , boost::move(boost::fusion::at_c< 4>(args))
     );
 }
Exemplo n.º 8
0
 void operator()(
     naming::id_type const & cont
   , naming::id_type const & id
   , Vector & args
 ) const
 {
     LLCO_(info)
         << "dataflow apply action "
         << hpx::actions::detail::get_action_name<Action>();
     hpx::apply_c<Action>(
         cont
       , id
       , BOOST_PP_ENUM(N, HPX_LCOS_DATAFLOW_M0, _)
     );
 }
Exemplo n.º 9
0
        void trigger()
        {
            LLCO_(info)
                << "typed_continuation<void>::trigger("
                << this->get_id() << ")";

            if (f_.empty()) {
                if (!this->get_id()) {
                    HPX_THROW_EXCEPTION(invalid_status,
                        "typed_continuation<void>::trigger",
                        "attempt to trigger invalid LCO (the id is invalid)");
                    return;
                }
                trigger_lco_event(this->get_id(), this->get_addr());
            }
            else {
                f_(this->get_id());
            }
        }
Exemplo n.º 10
0
        void trigger_value(RemoteResult && result)
        {
            LLCO_(info)
                << "typed_continuation<RemoteResult>::trigger_value("
                << this->get_id() << ")";

            if (this->f_.empty()) {
                if (!this->get_id()) {
                    HPX_THROW_EXCEPTION(invalid_status,
                        "typed_continuation<Result>::trigger_value",
                        "attempt to trigger invalid LCO (the id is invalid)");
                    return;
                }
                hpx::set_lco_value(this->get_id(), this->get_addr(),
                    std::move(result));
            }
            else {
                this->f_(this->get_id(), std::move(result));
            }
        }
Exemplo n.º 11
0
    void wait()
    { // {{{
        typedef typename
            lcos::template base_lco_with_value<ValueType>::get_value_action
        action_type;

        mutex_type::scoped_lock l(mtx_);

        typename thread_queue_type::const_iterator it = thread_queue_.begin()
                                                 , end = thread_queue_.end();

        for (; it != end; ++it)
        {
            naming::id_type id = it->id_;

            LLCO_(info) << "object_semapohre::wait: waiting for " << id;

            hpx::apply<action_type>(id);
        }
    } // }}}