hpx::future<void> set_data(hpx::future<hpx::id_type> id, std::size_t which, hpx::future<T> result) { typedef typename gather_server<T>::set_result_action action_type; return async(action_type(), id.get(), which, result.get()); }
hpx::future<std::vector<T> > gather_data(hpx::future<hpx::id_type> id, std::size_t site, hpx::future<T> result) { typedef typename gather_server<T>::get_result_action action_type; return async(action_type(), id.get(), site, result.get()); }
boost::uint64_t operator()( hpx::future<data_type> data ) const { data_type v = data.get(); return hpx::util::get<0>(v).get() + hpx::util::get<1>(v).get(); }
// this continuation function will be executed by an HPX thread int cont1(hpx::future<int> f) { hpx::cout << "cont1 thread id: " << hpx::this_thread::get_id() << hpx::endl; hpx::cout << "Status code (HPX thread): " << f.get() << hpx::endl; hpx::cout << hpx::flush; return 1; }
boost::uint64_t operator()( hpx::future<data_type> data ) const { data_type v = data.get(); return HPX_STD_GET(0, v).get() + HPX_STD_GET(1, v).get(); }
hpx::id_type register_name(hpx::future<hpx::id_type> id, char const* basename, std::size_t site) { hpx::id_type target = id.get(); hpx::register_with_basename(basename, target, site); return target; }
void then_test_void(hpx::future<void> f, int passed_through) { HPX_ASSERT(f.is_ready()); // make sure, future is ready f.get(); // propagate exceptions HPX_TEST_EQ(passed_through, 42); }
void null_callback( std::vector<double>& dd , boost::uint64_t j , hpx::future<double> f ) { dd[j] = f.get(); }
/// Register the id wrapped in the given future using the given base name. /// /// The function registers the object the given future refers to using the /// provided base name. /// /// \param base_name [in] The base name for which to retrieve the /// registered ids. /// \param f [in] The future which should be registered using /// the given base name. /// \param sequence_nr [in, optional] The sequential number to use for the /// registration of the id. This number has to be /// unique system wide for each registration using the /// same base name. The default is the current locality /// identifier. Also, the sequence numbers have to be /// consecutive starting from zero. /// /// \returns A future representing the result of the registration operation /// itself. /// /// \note The operation will fail if the given sequence number is not /// unique. /// inline hpx::future<bool> register_with_basename(std::string const& base_name, hpx::future<hpx::id_type> f, std::size_t sequence_nr = ~0U) { return f.then( [=](hpx::future<hpx::id_type> && f) mutable { return register_with_basename(base_name, f.get(), sequence_nr); }); }
boost::int64_t calc_cell( boost::uint32_t i , boost::uint32_t j , char ai , char bj , hpx::future<boost::int64_t> const& left // H(i, j-1) , hpx::future<boost::int64_t> const& diagonal // H(i-1, j-1) , hpx::future<boost::int64_t> const& up // H(i-1, j) ) { boost::int64_t match_mismatch = 0; if (ai == bj) { match_mismatch = diagonal.get() + match; } else { match_mismatch = diagonal.get() + mismatch; } boost::int64_t deletion = up.get() + gap; boost::int64_t insertion = left.get() + gap; boost::int64_t ij_value = maximum(boost::int64_t(0), match_mismatch, deletion, insertion); winner H_best_old = H_best.load(); while (true) { winner H_best_new(ij_value, i, j); if (H_best_new.value > H_best_old.value) { if (H_best.compare_exchange_weak(H_best_old, H_best_new)) break; } else break; } return ij_value; }
static std::string device_uint_to_string(hpx::future<std::vector<char>> data_future) { std::vector<char> data_raw = data_future.get(); cl_uint res = *((cl_uint*)data_raw.data()); std::stringstream ss; ss << res; return ss.str(); }
static std::string device_type_to_string(hpx::future<std::vector<char>> type_future) { std::vector<char> type_raw = type_future.get(); cl_device_type type = *((cl_device_type*) type_raw.data()); std::vector<std::string> typelist; if(type & CL_DEVICE_TYPE_CPU) typelist.push_back("cpu"); if(type & CL_DEVICE_TYPE_GPU) typelist.push_back("gpu"); if(type & CL_DEVICE_TYPE_ACCELERATOR) typelist.push_back("accelerator"); if(type & CL_DEVICE_TYPE_DEFAULT) typelist.push_back("default"); #ifdef CL_VERSION_1_2 if(type & CL_DEVICE_TYPE_CUSTOM) typelist.push_back("custom"); #endif std::string result = ""; for(size_t i = 0 ; i < typelist.size(); i++) { if(i > 0) result += ", "; result += typelist[i]; } return result; }
boost::uint64_t add( hpx::future<boost::uint64_t> f1, hpx::future<boost::uint64_t> f2) { return f1.get() + f2.get(); }
// this continuation function will be executed by the UI (main) thread, which is // not an HPX thread int cont2(hpx::future<int> f) { std::cout << "Status code (main thread): " << f.get() << std::endl; return 1; }
std::shared_ptr<Component> get_ptr_postproc(hpx::future<naming::address> f, naming::id_type const& id) { return get_ptr_postproc_helper<Component, Deleter>(f.get(), id); }
int int_f5(int i, hpx::future<int> j) { ++int_f5_count; return i+j.get()+42; }