diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-05 18:47:50 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-05 18:47:50 +0200 |
commit | 165dc04776c320d95a2ec16bedd4c18fa157262a (patch) | |
tree | 2b0ecbe439896e8ff6e6ccb6d7dd7a5d72c48601 /include/my_atomic_wrapper.h | |
parent | f424eb974d2cf5fe875fb41129ee2e638c67eebe (diff) | |
download | mariadb-git-bb-10.5-MDEV-24142.tar.gz |
MDEV-24142 rw_lock_t has unnecessarily complex wait logicbb-10.5-MDEV-24142
Let us use a single rw_lock_t::wait_mutex and two condition
variables wait_cond, wait_cond_ex instead of two os_event_t
(which wrap a mutex and condition variable and some other data)
sync_array_wait_event(): Implement new waiting rules for rw_lock_t.
FIXME: Sometimes, rw_lock_x_lock_wait_func() hangs here, with
lock->lock_word == -X_LOCK_HALF_DECR.
Perhaps we should treat not only the values 0 and -X_LOCK_HALF_DECR
but also X_LOCK_HALF_DECR specially?
rw_lock_x_unlock_func(): Clean up.
Diffstat (limited to 'include/my_atomic_wrapper.h')
-rw-r--r-- | include/my_atomic_wrapper.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/my_atomic_wrapper.h b/include/my_atomic_wrapper.h index c0e18ea7c91..b256ba1069a 100644 --- a/include/my_atomic_wrapper.h +++ b/include/my_atomic_wrapper.h @@ -41,7 +41,9 @@ public: Atomic_relaxed(Type val) : m(val) {} Atomic_relaxed() {} - operator Type() const { return m.load(std::memory_order_relaxed); } + Type load(std::memory_order o= std::memory_order_relaxed) const + { return m.load(o); } + operator Type() const { return load(); } Type operator=(const Type val) { m.store(val, std::memory_order_relaxed); return val; } Type operator=(const Atomic_relaxed<Type> &rhs) { return *this= Type{rhs}; } |