Skip to content

Instantly share code, notes, and snippets.

@sithhell
Created January 22, 2016 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sithhell/64d3cb1bf7c54c148889 to your computer and use it in GitHub Desktop.
Save sithhell/64d3cb1bf7c54c148889 to your computer and use it in GitHub Desktop.
// schedule threads based on given parcel
void applier::schedule_action(parcelset::parcel p, std::size_t num_thread)
{
// fetch the set of destinations
#if !defined(HPX_SUPPORT_MULTIPLE_PARCEL_DESTINATIONS)
std::size_t const size = 1ul;
#else
std::size_t const size = p.size();
#endif
naming::id_type const* ids = p.destinations();
naming::address const* addrs = p.addrs();
// make sure the target has not been migrated away
naming::resolver_client& client = hpx::naming::get_agas_client();
// Get the pinned pointers
std::vector<pinned_ptr> ptrs = client.get_pinned_ptrs(ids, size);
// If the pinned pointers are invalid, route the parcel
if (ptrs[0])
{
using hpx::util::placeholders::_1;
using hpx::util::placeholders::_2;
client.route(std::move(p),
util::bind(&detail::parcel_sent_handler,
std::ref(parcel_handler_), _1, _2));
return;
}
// .....
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment