};
//@cond
- struct basic_node
+ struct alignas( void* ) basic_node
{
enum flags {
internal = 1, ///< set for internal node
/// Constructs leaf (bIntrenal == false) or internal (bInternal == true) node
explicit basic_node( bool bInternal )
- : m_nFlags( bInternal ? internal : 0 )
- {}
+ {
+ m_nFlags.store( bInternal ? internal: 0, atomics::memory_order_release );
+ }
/// Checks if the node is a leaf
bool is_leaf() const
typedef basic_node base_class;
typedef GC gc ; ///< Garbage collector
+
/// Constructs leaf (bIntrenal == false) or internal (bInternal == true) node
explicit base_node( bool bInternal )
: base_class( bInternal )
, m_pLeft( nullptr )
, m_pRight( nullptr )
, m_pUpdate( update_ptr())
- , m_nEmptyUpdate(0)
- {}
+ {
+ m_nEmptyUpdate.store( 0, atomics::memory_order_release );
+ }
//@cond
update_ptr null_update_desc()
/// Item counter
/**
The type for item counter, by default it is disabled (\p atomicity::empty_item_counter).
- To enable it use \p atomicity::item_counter
+ To enable it use \p atomicity::item_counter or \p atomicity::cache_friendly_item_counter
*/
typedef atomicity::empty_item_counter item_counter;
Update descriptor is helping data structure with short lifetime and it is good candidate
for pooling. The number of simultaneously existing descriptors is bounded and it is
- limited the number of threads working with the tree.
+ limited by number of threads working with the tree.
Therefore, a bounded lock-free container like \p cds::container::VyukovMPMCCycleQueue
- is good choice for the free-list of update descriptors,
+ is a good choice for the free-list of update descriptors,
see \p cds::memory::vyukov_queue_pool free-list implementation.
Also notice that size of update descriptor is constant and not dependent on the type of data
- \p opt::disposer - the functor used for dispose removed nodes. Default is \p opt::v::empty_disposer. Due the nature
of GC schema the disposer may be called asynchronously. The disposer is used only for leaf nodes.
- \p opt::item_counter - the type of item counting feature, by default it is disabled (\p atomicity::empty_item_counter)
- To enable it use \p atomicity::item_counter
+ To enable it use \p atomicity::item_counter or \p atomicity::cache_friendly_item_counter
- \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
or \p opt::v::sequential_consistent (sequentially consisnent memory model).
- \p ellen_bintree::update_desc_allocator - an allocator of \ref ellen_bintree::update_desc "update descriptors",