本文整理汇总了C++中hpx::future::get方法的典型用法代码示例。如果您正苦于以下问题:C++ future::get方法的具体用法?C++ future::get怎么用?C++ future::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hpx::future
的用法示例。
在下文中一共展示了future::get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: async
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());
}
示例2: operator
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();
}
示例3: cont1
// 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;
}
示例4: HPX_STD_GET
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();
}
示例5: register_name
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;
}
示例6: then_test_void
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);
}
示例7: null_callback
void null_callback(
std::vector<double>& dd
, boost::uint64_t j
, hpx::future<double> f
)
{
dd[j] = f.get();
}
示例8: register_with_basename
/// 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);
});
}
示例9: H_best_new
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;
}
示例10:
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();
}
示例11: add
boost::uint64_t add(
hpx::future<boost::uint64_t> f1,
hpx::future<boost::uint64_t> f2)
{
return f1.get() + f2.get();
}
示例12: cont2
// 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;
}
示例13:
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);
}
示例14: int_f5
int int_f5(int i, hpx::future<int> j) { ++int_f5_count; return i+j.get()+42; }