summaryrefslogtreecommitdiff
path: root/storage/innobase/include/buf0buf.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/buf0buf.h')
-rw-r--r--storage/innobase/include/buf0buf.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 9b00f020964..8cac73b79e4 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1379,7 +1379,8 @@ public:
/** Copy constructor */
buf_page_t(const buf_page_t& b) :
id(b.id), hash(b.hash),
- buf_fix_count(b.buf_fix_count), io_fix_(b.io_fix()),
+ buf_fix_count(b.buf_fix_count.load(std::memory_order_relaxed)),
+ io_fix_(b.io_fix_.load(std::memory_order_relaxed)),
state_(b.state()),
flush_type(b.flush_type),
buf_pool_index(b.buf_pool_index),
@@ -1423,7 +1424,7 @@ public:
buf_pool->zip_hash */
/** Count of how manyfold this block is currently bufferfixed. */
- Atomic_counter<uint32_t> buf_fix_count;
+ std::atomic<uint32_t> buf_fix_count;
/** type of pending I/O operation; also protected by buf_pool->mutex */
std::atomic<buf_io_fix> io_fix_;
@@ -1574,10 +1575,11 @@ public:
in the buffer pool. Protected by
block mutex */
- void fix() { buf_fix_count++; }
- uint32_t unfix()
+ void fix(std::memory_order sync = std::memory_order_acquire)
+ { buf_fix_count.fetch_add(1, sync); }
+ uint32_t unfix(std::memory_order sync = std::memory_order_release)
{
- uint32_t count= buf_fix_count--;
+ uint32_t count= buf_fix_count.fetch_sub(1, sync);
ut_ad(count != 0);
return count - 1;
}
@@ -1596,11 +1598,13 @@ public:
}
/** @return the I/O fix status of the block */
- buf_io_fix io_fix() const { return io_fix_; }
+ buf_io_fix io_fix(std::memory_order sync = std::memory_order_relaxed) const
+ { return io_fix_.load(sync); }
/** Set the io_fix of the block. */
- void set_io_fix(buf_io_fix io_fix)
- { ut_ad(holding_buf_pool_mutex()); io_fix_ = io_fix; }
+ void set_io_fix(buf_io_fix io_fix,
+ std::memory_order sync = std::memory_order_relaxed)
+ { ut_ad(holding_buf_pool_mutex()); io_fix_.store(io_fix, sync); }
/** @return the state of of the block */
buf_page_state state() const { return state_; }