Changeset 3948 for trunk/test/queue.cc
- Timestamp:
- Jul 20, 2020, 9:12:46 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/queue.cc
r3062 r3948 26 26 #include "yat/utility/Queue.h" 27 27 28 #include <boost/thread.hpp>29 30 28 #include <iostream> 29 #include <thread> 30 #include <vector> 31 31 32 32 using namespace theplu::yat; … … 50 50 } 51 51 sleep(1); 52 // Make sure we can be interrupted53 boost::this_thread::interruption_point();54 52 } 55 53 } … … 65 63 queue.push("Peter"); 66 64 67 boost::thread_group workers;68 workers.create_thread(Worker(queue));69 workers.create_thread(Worker(queue));70 workers.create_thread(Worker(queue));71 workers.create_thread(Worker(queue));65 std::vector<std::thread> threads; 66 threads.push_back(std::thread(Worker(queue))); 67 threads.push_back(std::thread(Worker(queue))); 68 threads.push_back(std::thread(Worker(queue))); 69 threads.push_back(std::thread(Worker(queue))); 72 70 73 workers.join_all(); 71 for (size_t i=0; i<threads.size(); ++i) 72 threads[i].join(); 74 73 75 74 Queue<std::string> queue2(queue);
Note: See TracChangeset
for help on using the changeset viewer.