共 9 篇文章 |
|
获取Future的T类型的value值可以通过Future<T>::get()方法,该方法是阻塞的,所以一定要确保该Future已经处于completed状态或者是其他线程将设置该Future的completed状态。map()属于Future的高阶函数应用,它持有一个元素类型为Future<A>的集合和一个可以被传递给Future<A>::then()的函数,然后用这些函数作为参数反过来调用... 阅497 转0 评0 公众公开 19-01-23 11:57 |
C++11之std::future和std::promise.// 线程睡眠10s return 4; }); std::thread t1(std::ref(task)); std::future<int> f1 = task.get_future(); auto r = f1.get();// 线程外阻塞等待 std::cout <<r << std::endl; return 0;}// launch on a thread // future from an async() std::future<int> f2 = std::async(std::... 阅442 转1 评0 公众公开 18-07-12 14:27 |
Facebook Folly Wangle Proxgen系列库编译。cd folly/follyLDFLAGS=”-L/home/choudan/code/common/lib” CPPFLAGS=”-I/home/choudan/code/common/include -I/home/choudan/code/common/include/libevent -fPIC -g -lpthread” ./configure –prefix=/home/choudan/code/common/folly/ –exec-prefix=/home/choudan/code/common/folly/ –disa... 阅369 转0 评0 公众公开 17-10-11 18:43 |
揭秘Facebook官方底层C++函数Folly.内部依赖方面没有限制,这意味着某个特定的folly模块可以使用其他任何的folly组件。在顶层,Folly采用经典的“结巴”(stuttering)方案folly/folly,这也是Boost及其他组件库所采用的。你的代码不该使用folly/experimental中的文件,以免你在更新Folly时,出现问题。folly/folly/test子目录包括了面向所有组... 阅54 转0 评0 公众公开 17-10-11 17:37 |
folly学习心得学习代码库的一般步骤。folly库的学习心得独立有用的小技巧。String.h ---- 非常有用的string工具集合:std::string <=> FBstring 互转工具、C风格转义字符串工具(反转工具)、stringPrintf工具、prettyPrint(支持时间、容量等常见单位)、hexDump工具、errnoStr\exceptionStr、demangle(串化C++类型)、split(分拆字符串)。... 阅76 转1 评0 公众公开 17-10-11 17:36 |