1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-24334 make monitor_set_tbl global variable thread-safe

Atomic_relaxed<T>: add fetch_or() and fetch_and()

innodb_init(): rely on a zero-initialization of a global variable

monitor_set_tbl: make Atomic_relaxed<ulint> array and use proper operations
for setting bit, unsetting bit and reading bit

Reviewed by: Marko Mäkelä
This commit is contained in:
Eugene Kosov
2020-12-02 11:34:37 +03:00
parent fccd810404
commit a50cb4867a
4 changed files with 18 additions and 16 deletions

View File

@@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#pragma once
#ifdef __cplusplus
#include <atomic>
/**
@@ -50,6 +51,10 @@ public:
{ return m.fetch_sub(i, o); }
Type fetch_xor(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_xor(i, o); }
Type fetch_and(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_and(i, o); }
Type fetch_or(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_or(i, o); }
bool compare_exchange_strong(Type& i1, const Type i2,
std::memory_order o1= std::memory_order_relaxed,
std::memory_order o2= std::memory_order_relaxed)