MySQL 8.4.2
Source Code Documentation
|
A node in a linked list of arrays. More...
#include <ut0lock_free_hash.h>
Public Types | |
typedef ut_lock_free_list_node_t< T > * | next_t |
Public Member Functions | |
ut_lock_free_list_node_t (size_t n_elements) | |
Constructor. More... | |
next_t | grow (int64_t deleted_val, bool *grown_by_this_thread) |
Create and append a new array to this one and store a pointer to it in 'm_next'. More... | |
ut_lock_free_cnt_t::handle_t | begin_access () |
Mark the beginning of an access to this object. More... | |
void | await_release_of_old_references () |
Wait until all previously held references are released. More... | |
Static Public Member Functions | |
static ut_lock_free_list_node_t * | alloc (size_t n_elements) |
static void | dealloc (ut_lock_free_list_node_t *ptr) |
Public Attributes | |
ut::unique_ptr< T[]> | m_base |
Base array. More... | |
size_t | m_n_base_elements |
Number of elements in 'm_base'. More... | |
std::atomic_bool | m_pending_free |
Indicate whether some thread is waiting for readers to go away before it can free the memory occupied by the m_base member. More... | |
std::atomic< next_t > | m_next |
Pointer to the next node if any or NULL. More... | |
Private Member Functions | |
size_t | n_deleted (int64_t deleted_val) const |
Count the number of deleted elements. More... | |
Private Attributes | |
ut_lock_free_cnt_t | m_n_ref |
Counter for the current number of readers and writers to this object. More... | |
A node in a linked list of arrays.
The pointer to the next node is atomically set (CAS) when a next element is allocated.
typedef ut_lock_free_list_node_t<T>* ut_lock_free_list_node_t< T >::next_t |
|
inlineexplicit |
Constructor.
[in] | n_elements | number of elements to create |
|
inlinestatic |
|
inline |
Wait until all previously held references are released.
|
inline |
Mark the beginning of an access to this object.
Used to prevent a destruction of an array pointed by m_base while our thread is accessing it.
|
inlinestatic |
|
inline |
Create and append a new array to this one and store a pointer to it in 'm_next'.
This is done in a way that multiple threads can attempt this at the same time and only one will succeed. When this method returns, the caller can be sure that the job is done (either by this or another thread).
[in] | deleted_val | the constant that designates that a value is deleted |
[out] | grown_by_this_thread | set to true if the next array was created and appended by this thread; set to false if created and appended by another thread. |
|
inlineprivate |
Count the number of deleted elements.
The value returned could be inaccurate because it is obtained without any locks.
[in] | deleted_val | the constant that designates that a value is deleted |
ut::unique_ptr<T[]> ut_lock_free_list_node_t< T >::m_base |
Base array.
size_t ut_lock_free_list_node_t< T >::m_n_base_elements |
Number of elements in 'm_base'.
|
private |
Counter for the current number of readers and writers to this object.
This object is destroyed only after it is removed from the list, so that no new readers or writers may arrive, and after this counter has dropped to zero.
std::atomic<next_t> ut_lock_free_list_node_t< T >::m_next |
Pointer to the next node if any or NULL.
This begins its life as NULL and is only changed once to some real value. Never changed to another value after that.
std::atomic_bool ut_lock_free_list_node_t< T >::m_pending_free |
Indicate whether some thread is waiting for readers to go away before it can free the memory occupied by the m_base member.