Clean-ups
[invirt/third/libt4.git] / rpc / thread_pool.h
1 #ifndef thread_pool_h
2 #define thread_pool_h
3
4 #include <functional>
5 #include <vector>
6 #include "fifo.h"
7
8 typedef std::function<void()> job_t;
9
10 class thread_pool {
11     public:
12         thread_pool(size_t sz);
13         ~thread_pool();
14         bool addJob(const job_t & j);
15
16     private:
17         fifo<job_t> jobq_;
18         std::vector<thread> th_;
19         void do_worker();
20 };
21
22 #endif