Welcome to mirror list, hosted at ThFree Co, Russian Federation.

thread_pool.hpp « base - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ddd664ae281d6093508b179c05e272bcf5778a75 (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 <functional>

namespace threads
{
  class IRoutine;

  typedef std::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;
  };
}