Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
14 namespace Botan {
15
16 class Semaphore final
17 {
18 public:
19 explicit Semaphore(int value = 0) : m_value(value), m_wakeups(0) {}
20
21 void acquire();
22
23 void release(size_t n = 1);
24
25 private:
26 int m_value;
27 int m_wakeups;
28 std::mutex m_mutex;
29 std::condition_variable m_cond;
30 };
31
32 }
33
34 #endif
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
Botan::Semaphore::release
void release(size_t n=1)
Definition: semaphore.cpp:14
Botan
Definition: alg_id.cpp:13
Botan::Semaphore
Definition: semaphore.h:16
Botan::Semaphore::Semaphore
Semaphore(int value=0)
Definition: semaphore.h:19
Botan::Semaphore::acquire
void acquire()
Definition: semaphore.cpp:28