Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/asio.hpp>
- #include <boost/thread.hpp>
- int main(int argc, char* argv[]) {
- for (int i = 0; i < 100000; ++i) {
- std::cout << i << std::endl;
- boost::asio::io_service ioService;
- boost::asio::deadline_timer timer(ioService);
- ioService.post([&](){
- timer.expires_from_now(boost::posix_time::milliseconds(1));
- timer.async_wait([](const boost::system::error_code &) {});
- });
- ioService.post([&](){
- ioService.post([](){});
- });
- // Run some threads
- boost::thread_group workers;
- for (auto i=0; i<3; ++i) {
- workers.create_thread([&](){ ioService.run(); });
- }
- workers.join_all();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment