Ejemplo n.º 1
0
    void runtime_support::free_component_sync(agas::gva const& g,
        naming::gid_type const& gid, std::uint64_t count)
    {
        typedef server::runtime_support::free_component_action action_type;

        // Determine whether the gid of the component to delete is local or
        // remote
        std::pair<bool, components::pinned_ptr> r;

        naming::address addr;
        if (g.prefix == hpx::get_locality() ||
            agas::is_local_address_cached(gid, addr))
        {
            typedef action_type::component_type component_type;
            if (traits::component_supports_migration<component_type>::call())
            {
                r = traits::action_was_object_migrated<action_type>::call(
                    hpx::id_type(gid, hpx::id_type::unmanaged), addr.address_);
                if (!r.first)
                {
                    // apply locally
                    components::server::runtime_support* p =
                        reinterpret_cast<components::server::runtime_support*>(
                            hpx::get_runtime().get_runtime_support_lva());
                    p->free_component(g, gid, count);
                    return;
                }
            }
            else
            {
                // apply locally
                components::server::runtime_support* p =
                    reinterpret_cast<components::server::runtime_support*>(
                        hpx::get_runtime().get_runtime_support_lva());
                p->free_component(g, gid, count);
                return;
            }
        }

        // apply remotely (only if runtime is not stopping)
        naming::id_type id = get_colocation_id(
            launch::sync, naming::id_type(gid, naming::id_type::unmanaged));

        lcos::packaged_action<action_type, void> p;
        lcos::future<void> f = p.get_future();
        p.apply(id, g, gid, count);
        f.get();
    }
Ejemplo n.º 2
0
naming::id_type get_colocation_id_sync(
    naming::id_type const& id
  , error_code& ec)
{
    return get_colocation_id(id).get(ec);
}