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

fence_manager.hpp « base - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5bfdbf49a0946a97e6c85828704292235a624062 (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/condition.hpp"
#include "../base/mutex.hpp"

#include "../std/map.hpp"
#include "../std/list.hpp"

class FenceManager
{
private:

  threads::Mutex m_mutex;
  list<threads::Condition *> m_conditionPool;
  map<int, threads::Condition *> m_activeFences;
  int m_currentFence;
  bool m_isCancelled;

public:

  FenceManager(int conditionPoolSize);
  ~FenceManager();

  int  insertFence();
  void joinFence(int id);
  void signalFence(int id);
  void cancel();
};