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