apply();
}
- raw_ptr_disposer& operator=(raw_ptr_disposer&& d)
+ raw_ptr_disposer& combine(raw_ptr_disposer&& d)
{
- assert( pReclaimedChain == nullptr );
- pReclaimedChain = d.pReclaimedChain;
+ if ( pReclaimedChain == nullptr )
+ pReclaimedChain = d.pReclaimedChain;
+ else if ( d.pReclaimedChain ) {
+ // union reclaimed chains
+ node_type * pEnd = d.pReclaimedChain;
+ for ( ; pEnd->m_pDelChain; pEnd = pEnd->m_pDelChain );
+ pEnd->m_pDelChain = pReclaimedChain;
+ pReclaimedChain = d.pReclaimedChain;
+ }
d.pReclaimedChain = nullptr;
return *this;
}
raw_ptr_disposer& operator=(raw_ptr_disposer const& d) = delete;
+ raw_ptr_disposer& operator=( raw_ptr_disposer&& d ) = delete;
void apply()
{
outside RCU lock.
The object of \p %raw_ptr solves that problem: it contains the pointer to the node found
- and a chain of nodes that were reclaimed during traversing. The \p %raw_ptr object destructor
+ and a chain of nodes that were be reclaimed during traversing. The \p %raw_ptr object destructor
frees the chain (but not the node found) passing it to RCU \p batch_retire().
The object of \p %raw_ptr class must be destructed only outside RCU-lock of current thread.
/// Move assignment operator
/**
This operator may be called only inside RCU-lock.
- The \p this should be empty.
*/
raw_ptr& operator=( raw_ptr&& p ) CDS_NOEXCEPT
{
- assert( empty() );
- if ( !rcu::is_locked() )
- release();
-
+ assert( rcu::is_locked());
m_ptr = p.m_ptr;
- m_Enum = std::move( p.m_Enum );
+ m_Enum.combine( std::move( p.m_Enum ));
p.m_ptr = nullptr;
return *this;
}