• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ hpx::future类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中hpx::future的典型用法代码示例。如果您正苦于以下问题:C++ future类的具体用法?C++ future怎么用?C++ future使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了future类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gather_data

 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());
 }
开发者ID:devangb,项目名称:hpx,代码行数:7,代码来源:gather.hpp


示例2: set_data

 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());
 }
开发者ID:devangb,项目名称:hpx,代码行数:7,代码来源:gather.hpp


示例3: 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);
}
开发者ID:K-ballo,项目名称:hpx,代码行数:8,代码来源:minimal_sync_executor.cpp


示例4: 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);
         });
 }
开发者ID:jyzhang-bjtu,项目名称:hpx,代码行数:31,代码来源:basename_registration.hpp


示例5: operator

 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();
 }
开发者ID:DawidvC,项目名称:hpx,代码行数:7,代码来源:fibonacci_futures.cpp


示例6: 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();
 }
开发者ID:Sanac,项目名称:hpx,代码行数:7,代码来源:fibonacci_futures.cpp


示例7: 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;
}
开发者ID:atrantan,项目名称:hpx,代码行数:8,代码来源:simple_future_continuation.cpp


示例8: 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;
 }
开发者ID:devangb,项目名称:hpx,代码行数:7,代码来源:gather.hpp


示例9: null_callback

void null_callback(
    std::vector<double>& dd
  , boost::uint64_t j
  , hpx::future<double> f
    )
{
    dd[j] = f.get();
}
开发者ID:AntonBikineev,项目名称:hpx,代码行数:8,代码来源:future_hang_on_then_629.cpp


示例10: calc_cell

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;
}
开发者ID:akemp,项目名称:hpxla,代码行数:42,代码来源:naive_smp_smith_waterman.cpp


示例11: device_uint_to_string

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();

}
开发者ID:josephwinston,项目名称:hpxcl,代码行数:15,代码来源:list_devices.cpp


示例12: device_type_to_string

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;

}
开发者ID:josephwinston,项目名称:hpxcl,代码行数:41,代码来源:list_devices.cpp


示例13: add

boost::uint64_t add(
    hpx::future<boost::uint64_t> f1,
    hpx::future<boost::uint64_t> f2)
{
    return f1.get() + f2.get();
}
开发者ID:Sanac,项目名称:hpx,代码行数:6,代码来源:fibonacci_futures.cpp


示例14: 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;
}
开发者ID:atrantan,项目名称:hpx,代码行数:7,代码来源:simple_future_continuation.cpp


示例15: get_ptr_postproc

 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);
 }
开发者ID:ShmuelLevine,项目名称:hpx,代码行数:6,代码来源:get_ptr.hpp


示例16: int_f5

int int_f5(int i, hpx::future<int> j) { ++int_f5_count; return i+j.get()+42; }
开发者ID:Bcorde5,项目名称:hpx,代码行数:1,代码来源:local_dataflow_executor.cpp



注:本文中的hpx::future类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ hpx::partitioned_vector类代码示例发布时间:2022-05-31
下一篇:
C++ host::Ptr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap