diff options
author | Eugene Kosov <claprix@yandex.ru> | 2018-12-20 17:42:16 +0300 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2018-12-21 10:16:03 +0200 |
commit | ed166f53fa6fb6911b7d1cc5bfdccd91563929b4 (patch) | |
tree | 413811e97ee958b922e97fde61f9f172f84e5ff6 | |
parent | b7a9563b2140f105e6451559f5985a9c3f03a70e (diff) | |
download | mariadb-git-ed166f53fa6fb6911b7d1cc5bfdccd91563929b4.tar.gz |
MDEV-18043 data race in os_event
os_event::is_set(): protect os_event::m_set with os_event::mutex
-rw-r--r-- | storage/innobase/os/os0event.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/storage/innobase/os/os0event.cc b/storage/innobase/os/os0event.cc index 71b86df24a4..f2931239c3a 100644 --- a/storage/innobase/os/os0event.cc +++ b/storage/innobase/os/os0event.cc @@ -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: @@ -224,7 +227,7 @@ private: 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 */ |