CUBRID Engine
latest
|
#include <lockfree_circular_queue.hpp>
Public Types | |
using | cursor_type = std::uint64_t |
using | atomic_cursor_type = std::atomic< cursor_type > |
using | data_type = T |
using | atomic_flag_type = atomic_cursor_type |
Public Member Functions | |
circular_queue (std::size_t size) | |
~circular_queue () | |
bool | is_empty () const |
bool | is_full () const |
bool | is_half_full () |
std::size_t | size () |
bool | consume (T &element) |
bool | produce (const T &element) |
void | force_produce (const T &element) |
std::uint64_t | get_consumer_cursor () |
Private Member Functions | |
circular_queue () | |
circular_queue (const circular_queue &) | |
std::size_t | next_pow2 (std::size_t size) const |
bool | test_empty_cursors (cursor_type produce_cursor, cursor_type consume_cursor) const |
bool | test_full_cursors (cursor_type produce_cursor, cursor_type consume_cursor) const |
cursor_type | load_cursor (atomic_cursor_type &cursor) |
bool | test_and_increment_cursor (atomic_cursor_type &cursor, cursor_type crt_value) |
T | load_data (cursor_type consume_cursor) const |
void | store_data (cursor_type index, const T &data) |
std::size_t | get_cursor_index (cursor_type cursor) const |
bool | is_blocked (cursor_type cursor) const |
bool | block (cursor_type cursor) |
void | unblock (cursor_type cursor) |
void | init_blocked_cursors (void) |
Private Attributes | |
data_type * | m_data |
atomic_flag_type * | m_blocked_cursors |
atomic_cursor_type | m_produce_cursor |
atomic_cursor_type | m_consume_cursor |
std::size_t | m_capacity |
std::size_t | m_index_mask |
Static Private Attributes | |
static const cursor_type | BLOCK_FLAG |
Definition at line 46 of file lockfree_circular_queue.hpp.
using lockfree::circular_queue< T >::atomic_cursor_type = std::atomic<cursor_type> |
Definition at line 50 of file lockfree_circular_queue.hpp.
using lockfree::circular_queue< T >::atomic_flag_type = atomic_cursor_type |
Definition at line 52 of file lockfree_circular_queue.hpp.
using lockfree::circular_queue< T >::cursor_type = std::uint64_t |
Definition at line 49 of file lockfree_circular_queue.hpp.
using lockfree::circular_queue< T >::data_type = T |
Definition at line 51 of file lockfree_circular_queue.hpp.
|
inline |
Definition at line 208 of file lockfree_circular_queue.hpp.
References assert, lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::m_capacity, lockfree::circular_queue< T >::m_data, lockfree::circular_queue< T >::m_index_mask, and lockfree::circular_queue< T >::next_pow2().
|
inline |
Definition at line 222 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_blocked_cursors, and lockfree::circular_queue< T >::m_data.
|
private |
|
private |
|
inlineprivate |
Definition at line 477 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::BLOCK_FLAG, lockfree::circular_queue< T >::get_cursor_index(), flag< T >::get_flags(), and lockfree::circular_queue< T >::m_blocked_cursors.
Referenced by lockfree::circular_queue< T >::init_blocked_cursors(), and lockfree::circular_queue< T >::produce().
|
inline |
Definition at line 318 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::is_blocked(), lockfree::circular_queue< T >::load_cursor(), lockfree::circular_queue< T >::load_data(), lockfree::circular_queue< T >::m_consume_cursor, lockfree::circular_queue< T >::m_produce_cursor, lockfree::circular_queue< T >::test_and_increment_cursor(), and lockfree::circular_queue< T >::test_empty_cursors().
Referenced by pgbuf_lfcq_get_victim_from_private_lru(), pgbuf_lfcq_get_victim_from_shared_lru(), vacuum_consume_buffer_log_blocks(), and vacuum_data_mark_finished().
|
inline |
Definition at line 301 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::produce().
|
inline |
Definition at line 311 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_consume_cursor.
Referenced by pgbuf_get_victim().
|
inlineprivate |
Definition at line 448 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_index_mask.
Referenced by lockfree::circular_queue< T >::block(), lockfree::circular_queue< T >::is_blocked(), lockfree::circular_queue< T >::load_data(), lockfree::circular_queue< T >::store_data(), and lockfree::circular_queue< T >::unblock().
|
inlineprivate |
Definition at line 499 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::block(), lockfree::circular_queue< T >::is_blocked(), lockfree::circular_queue< T >::load_cursor(), lockfree::circular_queue< T >::load_data(), lockfree::circular_queue< T >::m_blocked_cursors, lockfree::circular_queue< T >::m_capacity, lockfree::circular_queue< T >::m_consume_cursor, lockfree::circular_queue< T >::m_produce_cursor, lockfree::circular_queue< T >::store_data(), lockfree::circular_queue< T >::test_and_increment_cursor(), lockfree::circular_queue< T >::test_full_cursors(), and lockfree::circular_queue< T >::unblock().
Referenced by lockfree::circular_queue< T >::circular_queue().
|
inlineprivate |
Definition at line 469 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::BLOCK_FLAG, lockfree::circular_queue< T >::get_cursor_index(), flag< T >::is_flag_set(), and lockfree::circular_queue< T >::m_blocked_cursors.
Referenced by lockfree::circular_queue< T >::consume(), and lockfree::circular_queue< T >::init_blocked_cursors().
|
inline |
Definition at line 374 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_consume_cursor, lockfree::circular_queue< T >::m_produce_cursor, and lockfree::circular_queue< T >::test_empty_cursors().
Referenced by pgbuf_get_victim(), vacuum_consume_buffer_log_blocks(), vacuum_finalize(), and xvacuum().
|
inline |
Definition at line 381 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_consume_cursor, lockfree::circular_queue< T >::m_produce_cursor, and lockfree::circular_queue< T >::test_full_cursors().
Referenced by xvacuum().
|
inline |
Definition at line 388 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_capacity, and lockfree::circular_queue< T >::size().
Referenced by vacuum_data_unload_first_and_last_page(), and vacuum_finished_block_vacuum().
|
inlineprivate |
Definition at line 433 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::consume(), lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::produce(), and lockfree::circular_queue< T >::size().
|
inlineprivate |
Definition at line 462 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::get_cursor_index(), and lockfree::circular_queue< T >::m_data.
Referenced by lockfree::circular_queue< T >::consume(), and lockfree::circular_queue< T >::init_blocked_cursors().
|
inlineprivate |
Definition at line 409 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::circular_queue().
|
inline |
Definition at line 230 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::block(), lockfree::circular_queue< T >::load_cursor(), lockfree::circular_queue< T >::m_consume_cursor, lockfree::circular_queue< T >::m_produce_cursor, lockfree::circular_queue< T >::store_data(), lockfree::circular_queue< T >::test_and_increment_cursor(), lockfree::circular_queue< T >::test_full_cursors(), and lockfree::circular_queue< T >::unblock().
Referenced by lockfree::circular_queue< T >::force_produce(), pgbuf_lfcq_add_lru_with_victims(), pgbuf_lfcq_get_victim_from_private_lru(), pgbuf_lfcq_get_victim_from_shared_lru(), vacuum_finished_block_vacuum(), vacuum_produce_log_block_data(), and vacuum_recover_lost_block_data().
|
inline |
Definition at line 395 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::load_cursor(), lockfree::circular_queue< T >::m_consume_cursor, and lockfree::circular_queue< T >::m_produce_cursor.
Referenced by lockfree::circular_queue< T >::is_half_full(), and pgbuf_peek_stats().
|
inlineprivate |
Definition at line 455 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::get_cursor_index(), and lockfree::circular_queue< T >::m_data.
Referenced by lockfree::circular_queue< T >::init_blocked_cursors(), and lockfree::circular_queue< T >::produce().
|
inlineprivate |
Definition at line 440 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::consume(), lockfree::circular_queue< T >::init_blocked_cursors(), and lockfree::circular_queue< T >::produce().
|
inlineprivate |
Definition at line 420 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::consume(), and lockfree::circular_queue< T >::is_empty().
|
inlineprivate |
Definition at line 426 of file lockfree_circular_queue.hpp.
References lockfree::circular_queue< T >::m_capacity.
Referenced by lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::is_full(), and lockfree::circular_queue< T >::produce().
|
inlineprivate |
Definition at line 486 of file lockfree_circular_queue.hpp.
References assert, lockfree::circular_queue< T >::BLOCK_FLAG, flag< T >::clear(), lockfree::circular_queue< T >::get_cursor_index(), flag< T >::get_flags(), flag< T >::is_set(), lockfree::circular_queue< T >::m_blocked_cursors, and lockfree::circular_queue< T >::m_capacity.
Referenced by lockfree::circular_queue< T >::init_blocked_cursors(), and lockfree::circular_queue< T >::produce().
|
staticprivate |
Definition at line 80 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::block(), lockfree::circular_queue< T >::is_blocked(), and lockfree::circular_queue< T >::unblock().
|
private |
Definition at line 104 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::block(), lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::is_blocked(), lockfree::circular_queue< T >::unblock(), and lockfree::circular_queue< T >::~circular_queue().
|
private |
Definition at line 109 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::circular_queue(), lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::is_half_full(), lockfree::circular_queue< T >::test_full_cursors(), and lockfree::circular_queue< T >::unblock().
|
private |
Definition at line 108 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::consume(), lockfree::circular_queue< T >::get_consumer_cursor(), lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::is_empty(), lockfree::circular_queue< T >::is_full(), lockfree::circular_queue< T >::produce(), and lockfree::circular_queue< T >::size().
|
private |
Definition at line 103 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::circular_queue(), lockfree::circular_queue< T >::load_data(), lockfree::circular_queue< T >::store_data(), and lockfree::circular_queue< T >::~circular_queue().
|
private |
Definition at line 110 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::circular_queue(), and lockfree::circular_queue< T >::get_cursor_index().
|
private |
Definition at line 107 of file lockfree_circular_queue.hpp.
Referenced by lockfree::circular_queue< T >::consume(), lockfree::circular_queue< T >::init_blocked_cursors(), lockfree::circular_queue< T >::is_empty(), lockfree::circular_queue< T >::is_full(), lockfree::circular_queue< T >::produce(), and lockfree::circular_queue< T >::size().