fix: Use lock_guard instead of lock/unlock calls
I just noticed it was technically possible for the "work thread" (in py plugin manager) to be started twice, due to improper lock/unlock calls.
This commit is contained in:
1 parent
e8bb64a80f
commit
69e338c1ca
1 file changed
+1
-3
@@ -88,13 +88,11 @@ struct __attribute__((visibility("hidden"))) PluginManager_Impl {
|
||||
PluginManager_SessionData *session_data;
|
||||
|
||||
void start_work_thread() {
|
||||
mx.lock();
|
||||
std::lock_guard<std::mutex> lock{mx};
|
||||
if (work_thread) {
|
||||
mx.unlock();
|
||||
return;
|
||||
}
|
||||
keep_going = true;
|
||||
mx.unlock();
|
||||
work_thread.emplace([&]() {
|
||||
PluginManager_SessionData sd;
|
||||
mx.lock();
|
||||
|
||||
Reference in new issue
Block a user