예제 #1
0
        hpx::future<void> mark_as_migrated(hpx::id_type const& to_migrate)
        {
            // we need to first lock the AGAS migrated objects table, only then
            // access (lock) the object
            return agas::mark_as_migrated(to_migrate.get_gid(),
                [this]() mutable -> std::pair<bool, hpx::future<void> >
                {
                    std::unique_lock<mutex_type> l(mtx_);

                    // make sure that no migration is currently in flight
                    if (was_marked_for_migration_)
                    {
                        l.unlock();
                        return std::make_pair(false,
                            hpx::make_exceptional_future<void>(
                                HPX_GET_EXCEPTION(invalid_status,
                                    "migration_support::mark_as_migrated",
                                    "migration operation is already in flight")
                            ));
                    }

                    if (1 == pin_count_)
                    {
                        // all is well, migration can be triggered now
                        return std::make_pair(true, make_ready_future());
                    }

                    // delay migrate operation until pin count goes to zero
                    was_marked_for_migration_ = true;

                    l.unlock();
                    return std::make_pair(true, trigger_migration_.get_future());
                });
        }
예제 #2
0
 // Return whether the given object was migrated, if it was not
 // migrated, it also returns a pinned pointer.
 static std::pair<bool, components::pinned_ptr>
 was_object_migrated(hpx::id_type const& id,
     naming::address::address_type lva)
 {
     return agas::was_object_migrated(id.get_gid(),
         [lva]() -> components::pinned_ptr
         {
             return components::pinned_ptr::create<this_component_type>(lva);
         });
 }
예제 #3
0
hpx::parcelset::parcel
generate_parcel(hpx::id_type const& dest_id, hpx::id_type const& cont, T && data)
{
    hpx::naming::address addr;
    hpx::naming::gid_type dest = dest_id.get_gid();
    hpx::naming::detail::strip_credits_from_gid(dest);
    hpx::parcelset::parcel p(hpx::parcelset::detail::create_parcel::call(
        std::move(dest), std::move(addr),
        hpx::actions::typed_continuation<hpx::id_type>(cont),
        Action(), hpx::threads::thread_priority_normal,
        std::forward<T>(data));

    p.set_source_id(hpx::find_here());
    p.size() = 4096;

    return p;
}