#include <iostream> #include <vector> #include <string> #include <boost/bind.hpp> #include <toast/async/worker_pool.hpp> void print(std::string const &msg) { std::cout << msg; } int main() { // just some vector of strings. std::vector<std::string> v; v.push_back("Will\n"); v.push_back("this\n"); v.push_back("print\n"); v.push_back("out\n"); v.push_back("in\n"); v.push_back("order\n"); v.push_back("or\n"); v.push_back("out\n"); v.push_back("of\n"); v.push_back("order?\n"); toast::async::init_default_worker_pool(3, true); for(int i = 0; i < v.size(); ++i) toast::async::default_worker_pool().push(boost::bind(&print, v[i])); }