blob: 292799b42b2b6738074e610b87b05331f283d873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#pragma once
#include "base/base.hpp"
#include "std/function.hpp"
namespace threads
{
class IRoutine;
typedef function<void(threads::IRoutine *)> TFinishRoutineFn;
class ThreadPool
{
public:
ThreadPool(size_t size, const TFinishRoutineFn & finishFn);
~ThreadPool();
// ThreadPool will not delete routine. You can delete it in finish_routine_fn if need
void PushBack(threads::IRoutine * routine);
void PushFront(threads::IRoutine * routine);
void Stop();
private:
class Impl;
Impl * m_impl;
};
}
|