Skip to content

Commit 93431e0

Browse files
committed
Lock options and registers with same object
1 parent 6239252 commit 93431e0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Source/Onix1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ std::vector<int> Onix1::getDeviceIndices(device_map_t deviceMap, int hubIndex)
120120

121121
int Onix1::get_opt_(int option, void* value, size_t* size) const
122122
{
123-
const ScopedLock lock(optionLock);
123+
const ScopedLock lock(registerLock);
124124

125125
int rc = oni_get_opt(ctx_, option, value, size);
126126
if (rc != ONI_ESUCCESS)

Source/Onix1.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ namespace OnixSourcePlugin
8484
template <typename opt_t>
8585
int getOption(int option, opt_t* value)
8686
{
87+
const ScopedLock lock(registerLock);
88+
8789
size_t len = sizeof(opt_t);
8890
int rc = get_opt_(option, value, &len);
8991
return rc;
@@ -92,7 +94,7 @@ namespace OnixSourcePlugin
9294
template <typename opt_t>
9395
int setOption(int option, const opt_t value)
9496
{
95-
const ScopedLock lock(optionLock);
97+
const ScopedLock lock(registerLock);
9698

9799
int rc = oni_set_opt(ctx_, option, &value, opt_size_<opt_t>(value));
98100
if (rc != ONI_ESUCCESS) LOGE(oni_error_str(rc));
@@ -129,7 +131,6 @@ namespace OnixSourcePlugin
129131

130132
CriticalSection registerLock;
131133
CriticalSection frameLock;
132-
CriticalSection optionLock;
133134

134135
int major;
135136
int minor;

0 commit comments

Comments
 (0)