Commit dc90234b authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

Added lf_hash_size() macro, so that callers don't need to use atomic
operations.
parent 830a7c67
...@@ -167,6 +167,8 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins, ...@@ -167,6 +167,8 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins, int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
my_hash_walk_action action, void *argument); my_hash_walk_action action, void *argument);
#define lf_hash_size(hash) \
my_atomic_load32_explicit(&(hash)->count, MY_MEMORY_ORDER_RELAXED)
/* /*
shortcut macros to access underlying pinbox functions from an LF_HASH shortcut macros to access underlying pinbox functions from an LF_HASH
see lf_pinbox_get_pins() and lf_pinbox_put_pins() see lf_pinbox_get_pins() and lf_pinbox_put_pins()
......
...@@ -782,7 +782,7 @@ void MDL_map::destroy() ...@@ -782,7 +782,7 @@ void MDL_map::destroy()
{ {
delete m_backup_lock; delete m_backup_lock;
DBUG_ASSERT(!my_atomic_load32(&m_locks.count)); DBUG_ASSERT(!lf_hash_size(&m_locks));
lf_hash_destroy(&m_locks); lf_hash_destroy(&m_locks);
} }
......
...@@ -689,7 +689,7 @@ void tdc_deinit(void) ...@@ -689,7 +689,7 @@ void tdc_deinit(void)
ulong tdc_records(void) ulong tdc_records(void)
{ {
return my_atomic_load32_explicit(&tdc_hash.count, MY_MEMORY_ORDER_RELAXED); return lf_hash_size(&tdc_hash);
} }
......
...@@ -704,11 +704,7 @@ class rw_trx_hash_t ...@@ -704,11 +704,7 @@ class rw_trx_hash_t
because it may change even before this method returns. because it may change even before this method returns.
*/ */
uint32_t size() uint32_t size() { return uint32_t(lf_hash_size(&hash)); }
{
return uint32_t(my_atomic_load32_explicit(&hash.count,
MY_MEMORY_ORDER_RELAXED));
}
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment