Botan 3.6.1
Crypto and TLS for C&
semaphore.h
Go to the documentation of this file.
1/*
2* Semaphore
3* (C) 2013 Joel Low
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_SEMAPHORE_H_
9#define BOTAN_SEMAPHORE_H_
10
11#include <condition_variable>
12#include <mutex>
13
14namespace Botan {
15
17 public:
18 explicit Semaphore(int value = 0) : m_value(value), m_wakeups(0) {}
19
20 void acquire();
21
22 void release(size_t n = 1);
23
24 private:
25 int m_value;
26 int m_wakeups;
27 std::mutex m_mutex;
28 std::condition_variable m_cond;
29};
30
31} // namespace Botan
32
33#endif
void release(size_t n=1)
Definition semaphore.cpp:14
Semaphore(int value=0)
Definition semaphore.h:18
int(* final)(unsigned char *, CTX *)