Commit ed166f53 authored by Eugene Kosov's avatar Eugene Kosov Committed by Sergey Vojtovich

MDEV-18043 data race in os_event

os_event::is_set(): protect os_event::m_set with os_event::mutex
parent b7a9563b
...@@ -126,7 +126,10 @@ struct os_event { ...@@ -126,7 +126,10 @@ struct os_event {
/** @return true if the event is in the signalled state. */ /** @return true if the event is in the signalled state. */
bool is_set() const UNIV_NOTHROW bool is_set() const UNIV_NOTHROW
{ {
return(m_set); mutex.enter();
bool is_set = m_set;
mutex.exit();
return is_set;
} }
private: private:
...@@ -224,7 +227,7 @@ struct os_event { ...@@ -224,7 +227,7 @@ struct os_event {
int64_t signal_count; /*!< this is incremented int64_t signal_count; /*!< this is incremented
each time the event becomes each time the event becomes
signaled */ signaled */
EventMutex mutex; /*!< this mutex protects mutable EventMutex mutex; /*!< this mutex protects
the next fields */ the next fields */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment