projects
/
invirt/third/libt4.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
More clean-ups and cool template stuff
[invirt/third/libt4.git]
/
rpc
/
thr_pool.h
1
#ifndef thr_pool_h
2
#define thr_pool_h
3
4
#include <vector>
5
#include <thread>
6
7
#include "fifo.h"
8
9
typedef std::function<void()> job_t;
10
11
class ThrPool {
12
public:
13
ThrPool(size_t sz, bool blocking=true);
14
~ThrPool();
15
16
bool addJob(const job_t &j);
17
18
private:
19
size_t nthreads_;
20
bool blockadd_;
21
22
fifo<job_t> jobq_;
23
std::vector<std::thread> th_;
24
25
void do_worker();
26
};
27
28
#endif