#include "Poco/ActiveMethod.h"
#include "Poco/ActiveResult.h"
#include <utility>
#include <iostream>

using Poco::ActiveMethod;
using Poco::ActiveResult;

class ActiveAdder
{
public:
    ActiveAdder(): add(this, &ActiveAdder::addImpl)
    {
    }

ActiveMethod<int, std::pair<int, int>, ActiveAdder> add;

private:
    int addImpl(const std::pair<int, int>& args)
    {
        return args.first + args.second;
    }
};

int main(int argc, char** argv)
{
    ActiveAdder adder;

ActiveResult<int> sum = adder.add(std::make_pair(1, 2));
    // do other things
    for(int i=0;i<10;++i)
        std::cout<<i+1<<std::endl;
//    sum.wait();
    while(sum.available())
        break;
    std::cout << sum.data() << std::endl;

return 0;
}

最新文章

  1. SQL Server2014 SP2新增的数据库克隆功能
  2. October 19th Week 43rd Wednesday, 2016
  3. 手把手搭建WAMP+PHP+SVN开发环境
  4. cell重用的几种方式
  5. Android四大组件之Activity详解——创建和启动Activity
  6. 使Maven 2在package、install等阶段跳过运行Test的配置
  7. Netty开发UDP协议
  8. IDEA文件编码修改
  9. MySQL 定时器EVENT学习
  10. Form1和Form2的交互
  11. 剑指offer--面试题19
  12. Swift开源了,有什么好处?
  13. git 添加忽略文件
  14. COJN 0558 800600带通配符的字符串匹配
  15. Leetcode-34-Search Insert Position-(Medium)
  16. github上搜索资源
  17. hihoCoder1330 数组重排
  18. 智能压缩,摆脱用 Gzip 还是 Brotli 的纠结
  19. Summary on deep learning framework --- PyTorch
  20. Web存储及文件拖拽

热门文章

  1. C++ CheckListBox
  2. jitsi
  3. iOS开发中一些常用的方法
  4. Sqlserver到处数据到Excel
  5. HDU - 1693 Eat the Trees(多回路插头DP)
  6. 基于x86架构的内核Demo的详细开发文档
  7. careercup-排序和查找 11.6
  8. android中实现简单的播放
  9. WINDOWS Server2003上部署一个Asp.Net的网站
  10. case when then 与 count联合使用