30#include <boost/thread/condition_variable.hpp>
31#include <boost/thread/mutex.hpp>
32#include <boost/thread/thread.hpp>
47 static threadpool instance;
51 return new threadpool(max_threads);
58 boost::condition_variable cv;
63 void wait(threadpool *tpool);
71 void submit(waiter *waiter, std::function<
void()> f,
bool leaf =
false);
79 typedef struct entry {
81 std::function<void()> f;
84 std::deque<entry> queue;
85 boost::condition_variable has_work;
87 std::vector<boost::thread> threads;
91 void run(
bool flush =
false);