摘要: #include #include #include #include int producer_count = 0;boost::atomic_int consumer_count (0);boost::lockfree::spsc_queue > spsc_queue;//但生产者但消费者队列,... 阅读全文
posted @ 2014-07-06 23:42 zzyoucan 阅读(6071) 评论(0) 推荐(0) 编辑
摘要: resize改变的实际的大小,reserve是容量即capacity如果先指定capacity的大小,可以防止内存的重新分配,我感觉在分配实际的内存的时候会餐口capacity的大小,如果事先指定容量就会在原来的基础上分配而不是重新分配一次,这样不会出现内存碎片,对于那种大型的对象,效率会提高不少,... 阅读全文
posted @ 2014-07-06 23:30 zzyoucan 阅读(224) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include boost::atomic_int producer_count(0);boost::atomic_int consumer_count(0);boost::lockfree::stack stack(128);//多生产者多消... 阅读全文
posted @ 2014-07-06 21:39 zzyoucan 阅读(572) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include boost::atomic_int producer_count(0);boost::atomic_int consumer_count(0);boost::lockfree::queue queue(128);//无锁的多生产... 阅读全文
posted @ 2014-07-06 21:36 zzyoucan 阅读(4031) 评论(0) 推荐(0) 编辑
摘要: 只作了解,要想深入可以http://www.cnblogs.com/haippy/p/3252056.html看个最简单的例子#include #include #include #include #include using namespace std;boost::atomic_int a ;/... 阅读全文
posted @ 2014-07-06 12:53 zzyoucan 阅读(2503) 评论(0) 推荐(0) 编辑
摘要: #include // std::cout#include // std::thread#include // std::mutex, std::unique_lock#include // st... 阅读全文
posted @ 2014-07-06 11:03 zzyoucan 阅读(257) 评论(0) 推荐(0) 编辑
摘要: #include // std::cout#include // std::thread, std::this_thread::yield#include // std::mutex, std::uniq... 阅读全文
posted @ 2014-07-06 10:42 zzyoucan 阅读(217) 评论(0) 推荐(0) 编辑
摘要: c++这头烈马,我定将你驯服! 阅读全文
posted @ 2014-07-06 10:23 zzyoucan 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #include // std::cout#include // std::thread#include // std::mutex, std::unique_lock#include // st... 阅读全文
posted @ 2014-07-06 10:09 zzyoucan 阅读(538) 评论(0) 推荐(1) 编辑