else if ( pChild == child( m_pRoot, right_child, memory_model::memory_order_acquire )) {
result = try_update( key, cmp, nFlags, funcUpdate, m_pRoot, pChild, nChildVersion, disp );
}
+ else
+ result = update_flags::retry;
}
else {
// the tree is empty
{
node_scoped_lock l( m_Monitor, *m_pRoot );
if ( child( m_pRoot, right_child, memory_model::memory_order_acquire ) != nullptr ) {
- result = result == update_flags::retry;
+ result = update_flags::retry;
continue;
}
else if ( pChild == child( m_pRoot, right_child, memory_model::memory_order_acquire )) {
result = try_remove( key, cmp, func, m_pRoot, pChild, nChildVersion, disp );
}
+ else
+ result = update_flags::retry;
}
else
return false;
// pParent and pNode should be locked.
// Returns a damaged node, or nullptr if no more rebalancing is necessary
assert( parent( pNode, memory_model::memory_order_relaxed ) == pParent );
- assert( child( pParent, left_child, memory_model::memory_order_relaxed ) == pNode
- || child( pParent, right_child, memory_model::memory_order_relaxed ) == pNode );
node_type * pLeft = child( pNode, left_child, memory_model::memory_order_relaxed );
node_type * pRight = child( pNode, right_child, memory_model::memory_order_relaxed );
}
}
+ assert( child( pParent, left_child, memory_model::memory_order_relaxed ) == pNode
+ || child( pParent, right_child, memory_model::memory_order_relaxed ) == pNode );
+
int h = pNode->height( memory_model::memory_order_relaxed );
int hL = pLeft ? pLeft->height( memory_model::memory_order_relaxed ) : 0;
int hR = pRight ? pRight->height( memory_model::memory_order_relaxed ) : 0;
node_type * rebalance_to_right_locked( node_type * pParent, node_type * pNode, node_type * pLeft, int hR )
{
assert( parent( pNode, memory_model::memory_order_relaxed ) == pParent );
- assert( child( pParent, left_child, memory_model::memory_order_relaxed ) == pNode
+ assert( child( pParent, left_child, memory_model::memory_order_relaxed ) == pNode
|| child( pParent, right_child, memory_model::memory_order_relaxed ) == pNode );
// pParent and pNode is locked yet
node_type * rebalance_to_left_locked( node_type * pParent, node_type * pNode, node_type * pRight, int hL )
{
assert( parent( pNode, memory_model::memory_order_relaxed ) == pParent );
- assert( child( pParent, left_child, memory_model::memory_order_relaxed ) == pNode
+ assert( child( pParent, left_child, memory_model::memory_order_relaxed ) == pNode
|| child( pParent, right_child, memory_model::memory_order_relaxed ) == pNode );
// pParent and pNode is locked yet
typename pool_monitor_traits::empty_stat
>::type internal_stat;
+ /// Pool's default capacity
+ static CDS_CONSTEXPR size_t const c_nDefaultCapacity = 256;
+
private:
//@cond
static CDS_CONSTEXPR refspin_type const c_nSpinBit = 1;
/// Initializes the pool of 256 preallocated mutexes
pool_monitor()
- : m_Pool( 256 )
+ : m_Pool( c_nDefaultCapacity )
{}
/// Initializes the pool of \p nPoolCapacity preallocated mutexes
pool_monitor( size_t nPoolCapacity )
- : m_Pool( nPoolCapacity ? nPoolCapacity : 256 )
+ : m_Pool( nPoolCapacity ? nPoolCapacity : c_nDefaultCapacity )
{}
/// Makes exclusive access to node \p p