summaryrefslogtreecommitdiff
path: root/storage/innobase/read
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-12-28 15:23:54 +0400
committerSergey Vojtovich <svoj@mariadb.org>2018-12-29 14:02:15 +0400
commitfbe2a5b7d691f9742053623517e7fd8639562e63 (patch)
treef6918afae6cbf4e3ce790347e28753074c672d1e /storage/innobase/read
parent28d627392b3ea39ceefd8df7451813da660bf19d (diff)
downloadmariadb-git-fbe2a5b7d691f9742053623517e7fd8639562e63.tar.gz
MDEV-17441 - InnoDB transition to C++11 atomics
Almost trivial ReadView::m_state transition. Since C++11 doesn't seem to allow mixed (atomic and non-atomic) access to atomic variables, we have to perform all accesses atomically.
Diffstat (limited to 'storage/innobase/read')
-rw-r--r--storage/innobase/read/read0read.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/storage/innobase/read/read0read.cc b/storage/innobase/read/read0read.cc
index 470c8ec63f1..df2406fb0e4 100644
--- a/storage/innobase/read/read0read.cc
+++ b/storage/innobase/read/read0read.cc
@@ -200,7 +200,7 @@ inline void ReadView::snapshot(trx_t *trx)
void ReadView::open(trx_t *trx)
{
ut_ad(this == &trx->read_view);
- switch (m_state)
+ switch (state())
{
case READ_VIEW_STATE_OPEN:
ut_ad(!srv_read_only_mode);
@@ -254,8 +254,7 @@ void ReadView::open(trx_t *trx)
*/
mutex_enter(&trx_sys.mutex);
mutex_exit(&trx_sys.mutex);
- my_atomic_store32_explicit(&m_state, READ_VIEW_STATE_SNAPSHOT,
- MY_MEMORY_ORDER_RELAXED);
+ m_state.store(READ_VIEW_STATE_SNAPSHOT, std::memory_order_relaxed);
break;
default:
ut_ad(0);
@@ -264,8 +263,7 @@ void ReadView::open(trx_t *trx)
snapshot(trx);
reopen:
m_creator_trx_id= trx->id;
- my_atomic_store32_explicit(&m_state, READ_VIEW_STATE_OPEN,
- MY_MEMORY_ORDER_RELEASE);
+ m_state.store(READ_VIEW_STATE_OPEN, std::memory_order_release);
}
@@ -284,7 +282,7 @@ void trx_sys_t::clone_oldest_view()
for (const trx_t *trx= UT_LIST_GET_FIRST(trx_list); trx;
trx= UT_LIST_GET_NEXT(trx_list, trx))
{
- int32_t state;
+ uint32_t state;
while ((state= trx->read_view.get_state()) == READ_VIEW_STATE_SNAPSHOT)
ut_delay(1);