Skip to content

Commit

Permalink
MDEV-18043 data race in os_event
Browse files Browse the repository at this point in the history
os_event::is_set(): protect os_event::m_set with os_event::mutex
  • Loading branch information
kevgs authored and Sergey Vojtovich committed Dec 21, 2018
1 parent b7a9563 commit ed166f5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions storage/innobase/os/os0event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ struct os_event {
/** @return true if the event is in the signalled state. */
bool is_set() const UNIV_NOTHROW
{
return(m_set);
mutex.enter();
bool is_set = m_set;
mutex.exit();
return is_set;
}

private:
Expand Down Expand Up @@ -224,7 +227,7 @@ struct os_event {
int64_t signal_count; /*!< this is incremented
each time the event becomes
signaled */
EventMutex mutex; /*!< this mutex protects
mutable EventMutex mutex; /*!< this mutex protects
the next fields */


Expand Down

0 comments on commit ed166f5

Please sign in to comment.