return insert_with_at( head(), key, func );
}
- /// Ensures that the \p key exists in the list
+ /// Updates an element with given \p key
/**
The operation performs inserting or changing data with lock-free manner.
return bRet;
}
- /// Ensures that the item exists in the set
- /**
- The operation performs inserting or changing data with lock-free manner.
-
- If the \p val key not found in the set, then the new item created from \p val
- is inserted into the set. Otherwise, the functor \p func is called with the item found.
- The functor \p Func signature is:
- \code
- struct my_functor {
- void operator()( bool bNew, value_type& item, const Q& val );
- };
- \endcode
-
- with arguments:
- - \p bNew - \p true if the item has been inserted, \p false otherwise
- - \p item - item of the set
- - \p val - argument \p key passed into the \p ensure function
- The functor may change non-key fields of the \p item.
-
- The function applies RCU lock internally.
-
- Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
- \p second is true if new item has been added or \p false if the item with \p key
- already is in the set.
-
- @warning For \ref cds_nonintrusive_MichaelList_rcu "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting".
- \ref cds_nonintrusive_LazyList_rcu "LazyList" provides exclusive access to inserted item and does not require any node-level
- synchronization.
- */
/// Updates the element
/**
The operation performs inserting or changing data with lock-free manner.
return insert_node( alloc_node( std::forward<Args>(args)...));
}
- /// Ensures that the \p val exists in the set
+ /// Updates an element with given \p val
/**
The operation performs inserting or changing data with lock-free manner.
event_counter m_nInsertSuccess ; ///< Count of success insertion
event_counter m_nInsertFailed ; ///< Count of failed insertion
event_counter m_nInsertRetries ; ///< Count of unsuccessful retries of insertion
- event_counter m_nEnsureExist ; ///< Count of \p ensure call for existed node
- event_counter m_nEnsureNew ; ///< Count of \p ensure call for new node
- event_counter m_nEnsureRetries ; ///< Count of unsuccessful retries of ensuring
+ event_counter m_nUpdateExist ; ///< Count of \p update() call for existed node
+ event_counter m_nUpdateNew ; ///< Count of \p update() call for new node
+ event_counter m_nUpdateRetries ; ///< Count of unsuccessful retries of ensuring
event_counter m_nEraseSuccess ; ///< Count of successful call of \p erase and \p unlink
event_counter m_nEraseFailed ; ///< Count of failed call of \p erase and \p unlink
event_counter m_nEraseRetries ; ///< Count of unsuccessful retries inside erasing/unlinking
void onInsertSuccess() { ++m_nInsertSuccess ; }
void onInsertFailed() { ++m_nInsertFailed ; }
void onInsertRetry() { ++m_nInsertRetries ; }
- void onEnsureExist() { ++m_nEnsureExist ; }
- void onEnsureNew() { ++m_nEnsureNew ; }
- void onEnsureRetry() { ++m_nEnsureRetries ; }
+ void onUpdateExist() { ++m_nUpdateExist ; }
+ void onUpdateNew() { ++m_nUpdateNew ; }
+ void onUpdateRetry() { ++m_nUpdateRetries ; }
void onEraseSuccess() { ++m_nEraseSuccess ; }
void onEraseFailed() { ++m_nEraseFailed ; }
void onEraseRetry() { ++m_nEraseRetries ; }
void onInsertSuccess() const {}
void onInsertFailed() const {}
void onInsertRetry() const {}
- void onEnsureExist() const {}
- void onEnsureNew() const {}
- void onEnsureRetry() const {}
+ void onUpdateExist() const {}
+ void onUpdateNew() const {}
+ void onUpdateRetry() const {}
void onEraseSuccess() const {}
void onEraseFailed() const {}
void onEraseRetry() const {}
counter_type m_nInsertSuccess; ///< Count of success inserting
counter_type m_nInsertFailed; ///< Count of failed inserting
- counter_type m_nEnsureNew; ///< Count of new item created by \p ensure() member function
- counter_type m_nEnsureExist; ///< Count of \p ensure() call for existing item
+ counter_type m_nUpdateNew; ///< Count of new item created by \p ensure() member function
+ counter_type m_nUpdateExist; ///< Count of \p ensure() call for existing item
counter_type m_nEraseSuccess; ///< Count of success erasing of items
counter_type m_nEraseFailed; ///< Count of attempts to erase unknown item
counter_type m_nExtractSuccess; ///< Count of success extracting of items
//@cond
void onInsertSuccess() { ++m_nInsertSuccess; }
void onInsertFailed() { ++m_nInsertFailed; }
- void onEnsureNew() { ++m_nEnsureNew; }
- void onEnsureExist() { ++m_nEnsureExist; }
+ void onUpdateNew() { ++m_nUpdateNew; }
+ void onUpdateExist() { ++m_nUpdateExist; }
void onEraseSuccess() { ++m_nEraseSuccess; }
void onEraseFailed() { ++m_nEraseFailed; }
void onExtractSuccess() { ++m_nExtractSuccess; }
//@cond
void onInsertSuccess() const {}
void onInsertFailed() const {}
- void onEnsureNew() const {}
- void onEnsureExist() const {}
+ void onUpdateNew() const {}
+ void onUpdateExist() const {}
void onEraseSuccess() const {}
void onEraseFailed() const {}
void onExtractSuccess() const {}
func( false, *node_traits::to_value_ptr( res.pLeaf ), val );
if ( pNewInternal.get())
m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node
- m_Stat.onEnsureExist();
+ m_Stat.onUpdateExist();
return std::make_pair( true, false );
}
help( res.updParent, updRetire );
bkoff();
- m_Stat.onEnsureRetry();
+ m_Stat.onUpdateRetry();
}
}
++m_ItemCounter;
- m_Stat.onEnsureNew();
+ m_Stat.onUpdateNew();
return std::make_pair( true, true );
}
func( false, *node_traits::to_value_ptr( res.pLeaf ), val );
if ( pNewInternal.get() )
m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node
- m_Stat.onEnsureExist();
+ m_Stat.onUpdateExist();
return std::make_pair( true, false );
}
}
bkoff();
- m_Stat.onEnsureRetry();
+ m_Stat.onUpdateRetry();
}
++m_ItemCounter;
- m_Stat.onEnsureNew();
+ m_Stat.onUpdateNew();
return std::make_pair( true, true );
}
//@cond
std::pair<bool, bool> bRet = m_List.update_at( pHead, val, func, bAllowInsert );
if ( bRet.first && bRet.second ) {
inc_item_count();
- m_Stat.onEnsureNew();
+ m_Stat.onUpdateNew();
}
else
- m_Stat.onEnsureExist();
+ m_Stat.onUpdateExist();
return bRet;
}
//@cond
if ( ret.first != m_List.end() ) {
if ( ret.second ) {
inc_item_count();
- m_Stat.onEnsureNew();
+ m_Stat.onUpdateNew();
}
else
- m_Stat.onEnsureExist();
+ m_Stat.onUpdateExist();
return std::make_pair( iterator(ret.first, m_List.end()), ret.second );
}
return std::make_pair( end(), ret.second );
std::pair<bool, bool> bRet = m_List.update_at( pHead, val, func, bAllowInsert );
if ( bRet.first && bRet.second ) {
inc_item_count();
- m_Stat.onEnsureNew();
+ m_Stat.onUpdateNew();
}
else
- m_Stat.onEnsureExist();
+ m_Stat.onUpdateExist();
return bRet;
}
//@cond
<< CDSSTRESS_STAT_OUT( s, m_nInsertSuccess )
<< CDSSTRESS_STAT_OUT( s, m_nInsertFailed )
<< CDSSTRESS_STAT_OUT( s, m_nInsertRetries )
- << CDSSTRESS_STAT_OUT( s, m_nEnsureExist )
- << CDSSTRESS_STAT_OUT( s, m_nEnsureNew )
- << CDSSTRESS_STAT_OUT( s, m_nEnsureRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateExist )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateNew )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateRetries )
<< CDSSTRESS_STAT_OUT( s, m_nEraseSuccess )
<< CDSSTRESS_STAT_OUT( s, m_nEraseFailed )
<< CDSSTRESS_STAT_OUT( s, m_nEraseRetries )
//CDSUNIT_DECLARE_FeldmanHashMap_city
CDSUNIT_DECLARE_CuckooMap
- CPPUNIT_TEST_SUITE(Map_DelOdd)
+ CPPUNIT_TEST_SUITE_(Map_DelOdd, "map_delodd")
CDSUNIT_TEST_MichaelMap
CDSUNIT_TEST_SplitList
CDSUNIT_TEST_SkipListMap
<< "\t\t m_nInsertSuccess: " << s.m_nInsertSuccess.get() << "\n"
<< "\t\t m_nInsertFailed: " << s.m_nInsertFailed.get() << "\n"
<< "\t\t m_nInsertRetries: " << s.m_nInsertRetries.get() << "\n"
- << "\t\t m_nEnsureExist: " << s.m_nEnsureExist.get() << "\n"
- << "\t\t m_nEnsureNew: " << s.m_nEnsureNew.get() << "\n"
- << "\t\t m_nEnsureRetries: " << s.m_nEnsureRetries.get() << "\n"
+ << "\t\t m_nUpdateExist: " << s.m_nUpdateExist.get() << "\n"
+ << "\t\t m_nUpdateNew: " << s.m_nUpdateNew.get() << "\n"
+ << "\t\t m_nUpdateRetries: " << s.m_nUpdateRetries.get() << "\n"
<< "\t\t m_nEraseSuccess: " << s.m_nEraseSuccess.get() << "\n"
<< "\t\t m_nEraseFailed: " << s.m_nEraseFailed.get() << "\n"
<< "\t\t m_nEraseRetries: " << s.m_nEraseRetries.get() << "\n"
o << "Split-list stat [cds::intrusive::split_list::stat]\n"
<< "\t\t m_nInsertSuccess: " << s.m_nInsertSuccess.get() << "\n"
<< "\t\t m_nInsertFailed: " << s.m_nInsertFailed.get() << "\n"
- << "\t\t m_nEnsureExist: " << s.m_nEnsureExist.get() << "\n"
- << "\t\t m_nEnsureNew: " << s.m_nEnsureNew.get() << "\n"
+ << "\t\t m_nUpdateExist: " << s.m_nUpdateExist.get() << "\n"
+ << "\t\t m_nUpdateNew: " << s.m_nUpdateNew.get() << "\n"
<< "\t\t m_nEraseSuccess: " << s.m_nEraseSuccess.get() << "\n"
<< "\t\t m_nEraseFailed: " << s.m_nEraseFailed.get() << "\n"
<< "\t\t m_nExtractSuccess: " << s.m_nExtractSuccess.get() << "\n"
c_nSetSize = cfg.getSizeT("MapSize", c_nSetSize );
c_nInsertThreadCount = cfg.getSizeT("InsertThreadCount", c_nInsertThreadCount );
c_nDeleteThreadCount = cfg.getSizeT("DeleteThreadCount", c_nDeleteThreadCount );
- c_nUpdateThreadCount = cfg.getSizeT("EnsureThreadCount", c_nUpdateThreadCount );
+ c_nUpdateThreadCount = cfg.getSizeT("UpdateThreadCount", c_nUpdateThreadCount );
c_nThreadPassCount = cfg.getSizeT("ThreadPassCount", c_nThreadPassCount );
c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );