diff options
Diffstat (limited to 'libs/thread/example/producer_consumer.cpp')
-rw-r--r-- | libs/thread/example/producer_consumer.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libs/thread/example/producer_consumer.cpp b/libs/thread/example/producer_consumer.cpp index fb6e16b35..51979b6c7 100644 --- a/libs/thread/example/producer_consumer.cpp +++ b/libs/thread/example/producer_consumer.cpp @@ -22,7 +22,7 @@ typedef std::ostream the_ostream; typedef std::istream the_istream; #endif -#include <boost/thread/sync_queue.hpp> +#include <boost/thread/concurrent_queues/sync_queue.hpp> void producer(the_ostream &mos, boost::sync_queue<int> & sbq) { @@ -30,9 +30,9 @@ void producer(the_ostream &mos, boost::sync_queue<int> & sbq) try { for(int i=0; ;++i) { - sbq.push_back(i); + sbq.push(i); //sbq << i; - mos << "push_back(" << i << ") "<< sbq.size()<<"\n"; + mos << "push(" << i << ") "<< sbq.size()<<"\n"; this_thread::sleep_for(chrono::milliseconds(200)); } } @@ -55,7 +55,7 @@ void consumer( for(int i=0; ;++i) { int r; - sbq.pull_front(r); + sbq.pull(r); //sbq >> r; mos << i << " pull(" << r << ") "<< sbq.size()<<"\n"; @@ -78,7 +78,7 @@ void consumer2(the_ostream &mos, boost::sync_queue<int> & sbq) for(int i=0; ;++i) { int r; - queue_op_status st = sbq.try_pull_front(r); + queue_op_status st = sbq.try_pull(r); if (queue_op_status::closed == st) break; if (queue_op_status::success == st) { mos << i << " pull(" << r << ")\n"; @@ -98,9 +98,9 @@ void consumer3(the_ostream &mos, boost::sync_queue<int> & sbq) for(int i=0; ;++i) { int r; - queue_op_status res = sbq.wait_pull_front(r); + queue_op_status res = sbq.wait_pull(r); if (res==queue_op_status::closed) break; - mos << i << " wait_pull_front(" << r << ")\n"; + mos << i << " wait_pull(" << r << ")\n"; this_thread::sleep_for(chrono::milliseconds(250)); } } |