Boost 1.53.0ã«ã¯ãBoost.Lockfreeã¨ãã並è¡ã³ã³ããã®ã©ã¤ãã©ãªãå ¥ãã¾ããã ãã®ã©ã¤ãã©ãªã«ã¯ã¹ã¿ãã¯ã¨ãã¥ã¼ãç¨æããã¦ãã¾ããããã使ãã®ã¯ãã¥ã¼ã®æ¹ã§ãããã 使ãæ¹ã¯ä»¥ä¸ã®ããã«ãªãã¾ãã #include <iostream> #include <thread> #include <boost/lockfree/queue.hpp> boost::lockfree::queue<int> que(128); void producer() { for (int i = 0;; ++i) { while (!que.push(i)) {} } } void consumer() { for (;;) { int x = 0; if (que.pop(x)) { std::cout << x << std::endl; } } } int main() {
{{#tags}}- {{label}}
{{/tags}}