Botan
2.1.0
Crypto and TLS for C++11
Main Page
Namespaces
Classes
Files
File List
File Members
src
lib
utils
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 <botan/mutex.h>
12
13
#if defined(BOTAN_TARGET_OS_HAS_THREADS)
14
#include <condition_variable>
15
#endif
16
17
namespace
Botan
{
18
19
#if defined(BOTAN_TARGET_OS_HAS_THREADS)
20
class
Semaphore
21
{
22
public
:
23
explicit
Semaphore(
int
value = 0) : m_value(value), m_wakeups(0) {}
24
25
void
acquire();
26
27
void
release(
size_t
n = 1);
28
29
private
:
30
int
m_value;
31
int
m_wakeups;
32
mutex_type m_mutex;
33
std::condition_variable m_cond;
34
};
35
#endif
36
37
}
38
39
#endif
Botan
Definition:
alg_id.cpp:13
Generated on Fri Aug 4 2017 19:29:39 for Botan by
1.8.9.1