Loading [MathJax]/jax/output/HTML-CSS/config.js
VCV Rack API
v2
Toggle main menu visibility
Main Page
Namespaces
Namespace List
Namespace 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
y
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
y
Typedefs
a
b
c
d
e
f
g
h
i
k
l
p
r
s
t
v
w
y
Enumerations
Enumerator
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
r
s
t
u
v
w
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
Enumerations
Enumerator
b
c
h
i
l
m
n
o
p
r
t
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
l
n
o
p
r
s
t
v
w
Functions
Macros
_
a
b
c
d
e
f
g
i
l
n
p
r
s
t
v
w
▼
VCV Rack API
►
Namespaces
►
Classes
▼
Files
▼
File List
▼
include
►
app
►
dsp
►
engine
►
plugin
►
simd
►
ui
►
widget
►
window
arch.hpp
►
asset.hpp
►
audio.hpp
►
color.hpp
►
common.hpp
►
componentlibrary.hpp
►
context.hpp
►
gamepad.hpp
►
helpers.hpp
►
history.hpp
►
keyboard.hpp
►
library.hpp
►
logger.hpp
►
math.hpp
►
midi.hpp
►
midiloopback.hpp
►
mutex.hpp
►
network.hpp
►
patch.hpp
►
plugin.hpp
►
Quantity.hpp
►
rack.hpp
►
random.hpp
►
rtaudio.hpp
►
rtmidi.hpp
►
settings.hpp
►
string.hpp
►
system.hpp
►
tag.hpp
►
weakptr.hpp
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Loading...
Searching...
No Matches
mutex.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <
common.hpp
>
3
#include <pthread.h>
4
5
6
namespace
rack
{
7
8
16
struct
SharedMutex
{
17
pthread_rwlock_t
rwlock
;
18
19
SharedMutex
() {
20
int
err = pthread_rwlock_init(&
rwlock
,
NULL
);
21
(void) err;
22
assert(!err);
23
}
19
SharedMutex
() {
…
}
24
~SharedMutex
() {
25
pthread_rwlock_destroy(&
rwlock
);
26
}
24
~SharedMutex
() {
…
}
27
28
void
lock
() {
29
int
err = pthread_rwlock_wrlock(&
rwlock
);
30
(void) err;
31
assert(!err);
32
}
28
void
lock
() {
…
}
33
34
bool
try_lock
() {
35
return
pthread_rwlock_trywrlock(&
rwlock
) == 0;
36
}
34
bool
try_lock
() {
…
}
37
void
unlock
() {
38
int
err = pthread_rwlock_unlock(&
rwlock
);
39
(void) err;
40
assert(!err);
41
}
37
void
unlock
() {
…
}
42
43
void
lock_shared
() {
44
int
err = pthread_rwlock_rdlock(&
rwlock
);
45
(void) err;
46
assert(!err);
47
}
43
void
lock_shared
() {
…
}
48
49
bool
try_lock_shared
() {
50
return
pthread_rwlock_tryrdlock(&
rwlock
) == 0;
51
}
49
bool
try_lock_shared
() {
…
}
52
void
unlock_shared
() {
53
unlock
();
54
}
52
void
unlock_shared
() {
…
}
55
};
16
struct
SharedMutex
{
…
};
56
57
58
template
<
class
TMutex>
59
struct
SharedLock
{
60
TMutex&
m
;
61
62
SharedLock
(TMutex&
m
) :
m
(
m
) {
63
m
.lock_shared();
64
}
62
SharedLock
(TMutex&
m
) :
m
(
m
) {
…
}
65
~SharedLock
() {
66
m
.unlock_shared();
67
}
65
~SharedLock
() {
…
}
68
};
59
struct
SharedLock
{
…
};
69
70
71
}
// namespace rack
common.hpp
NULL
rack
Root namespace for the Rack API.
Definition
AudioDisplay.hpp:9
rack::SharedLock::SharedLock
SharedLock(TMutex &m)
Definition
mutex.hpp:62
rack::SharedLock::~SharedLock
~SharedLock()
Definition
mutex.hpp:65
rack::SharedLock::m
TMutex & m
Definition
mutex.hpp:60
rack::SharedMutex::try_lock_shared
bool try_lock_shared()
Returns whether the lock was acquired.
Definition
mutex.hpp:49
rack::SharedMutex::SharedMutex
SharedMutex()
Definition
mutex.hpp:19
rack::SharedMutex::unlock_shared
void unlock_shared()
Definition
mutex.hpp:52
rack::SharedMutex::lock
void lock()
Definition
mutex.hpp:28
rack::SharedMutex::~SharedMutex
~SharedMutex()
Definition
mutex.hpp:24
rack::SharedMutex::rwlock
pthread_rwlock_t rwlock
Definition
mutex.hpp:17
rack::SharedMutex::lock_shared
void lock_shared()
Definition
mutex.hpp:43
rack::SharedMutex::unlock
void unlock()
Definition
mutex.hpp:37
rack::SharedMutex::try_lock
bool try_lock()
Returns whether the lock was acquired.
Definition
mutex.hpp:34
include
mutex.hpp
Generated by
1.13.2