forked from Kistler-Group/sdbus-cpp
Fix potential data race in Proxy's condition variable
This commit is contained in:
committed by
Stanislav Angelovič
parent
a0dadcc6fe
commit
c137dfa213
@ -127,8 +127,8 @@ MethodReply Proxy::sendMethodCallMessageAndWaitForReply(const MethodCall& messag
|
|||||||
|
|
||||||
void Proxy::SyncCallReplyData::sendMethodReplyToWaitingThread(MethodReply& reply, const Error* error)
|
void Proxy::SyncCallReplyData::sendMethodReplyToWaitingThread(MethodReply& reply, const Error* error)
|
||||||
{
|
{
|
||||||
SCOPE_EXIT{ cond_.notify_one(); };
|
|
||||||
std::unique_lock lock{mutex_};
|
std::unique_lock lock{mutex_};
|
||||||
|
SCOPE_EXIT{ cond_.notify_one(); }; // This must happen before unlocking the mutex to avoid potential data race on spurious wakeup in the waiting thread
|
||||||
SCOPE_EXIT{ arrived_ = true; };
|
SCOPE_EXIT{ arrived_ = true; };
|
||||||
|
|
||||||
//error_ = nullptr; // Necessary if SyncCallReplyData instance is thread_local
|
//error_ = nullptr; // Necessary if SyncCallReplyData instance is thread_local
|
||||||
|
Reference in New Issue
Block a user