Skip to content

Instantly share code, notes, and snippets.

View zglozman's full-sized avatar

Zeev Glozman zglozman

  • SnkeOS
  • Gainesville, FL
View GitHub Profile
@snaewe
snaewe / run_many.cpp
Created November 25, 2011 15:38
run many jobs in a boost::asio::io_service
// Fixed example from: http://thisthread.blogspot.com/2011/04/multithreading-with-asio.html
void run (int tNumber) // 1.
{
boost::asio::io_service svc; // 2.
boost::thread_group threads;
{
std::auto_ptr<boost::asio::io_service::work> work(new boost::asio::io_service::work(svc)); //3.
for (int i = 0; i < tNumber; ++i) // 4.