Botan
3.7.1
Crypto and TLS for C&
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
c
d
f
i
m
n
r
s
t
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
f
h
i
m
n
o
p
r
s
t
u
v
w
Enumerations
b
c
d
e
k
m
n
o
p
s
t
x
Enumerator
_
a
b
c
d
e
f
h
k
l
m
n
p
q
r
s
t
u
w
x
Related Symbols
b
c
d
e
f
k
o
p
s
t
x
Files
File List
File Members
All
_
a
b
c
d
e
f
i
k
m
n
o
p
q
s
t
u
w
x
y
z
Functions
b
c
Variables
Typedefs
b
c
e
p
t
Enumerations
Enumerator
b
c
d
e
k
n
Macros
_
a
b
c
f
m
n
q
s
t
w
src
lib
utils
thread_utils
rwlock.h
Go to the documentation of this file.
1
/*
2
* (C) 2019 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#ifndef BOTAN_RWLOCK_H_
8
#define BOTAN_RWLOCK_H_
9
10
#include <botan/types.h>
11
#include <condition_variable>
12
#include <mutex>
13
14
namespace
Botan
{
15
16
/**
17
* A read-write lock. Writers are favored.
18
*/
19
class
BOTAN_TEST_API
RWLock
final
{
20
public
:
21
RWLock
();
22
23
void
lock
();
24
void
unlock
();
25
26
void
lock_shared();
27
void
unlock_shared();
28
29
private
:
30
std::mutex m_mutex;
31
std::condition_variable m_gate1;
32
std::condition_variable m_gate2;
33
uint32_t m_state;
34
35
// 2**31 concurrent readers should be enough for anyone
36
static
const
uint32_t is_writing =
static_cast<
uint32_t
>
(1) << 31;
37
static
const
uint32_t readers_mask = ~is_writing;
38
};
19
class
BOTAN_TEST_API
RWLock
final
{
…
};
39
40
}
// namespace Botan
41
42
#endif
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition
api.h:39
Botan::RWLock
Definition
rwlock.h:19
final
int(* final)(unsigned char *, CTX *)
Definition
commoncrypto_hash.cpp:29
Botan
Definition
alg_id.cpp:13
Botan::lock
secure_vector< T > lock(const std::vector< T > &in)
Definition
secmem.h:70
Botan::unlock
std::vector< T > unlock(const secure_vector< T > &in)
Definition
secmem.h:75
Generated by
1.12.0