From 15ebecff061b3655e272e0c2a9f3c33117fbb9fd Mon Sep 17 00:00:00 2001 From: khizmax Date: Thu, 2 Apr 2015 22:56:54 +0300 Subject: [PATCH] Removed trailing spaces --- cds/container/bronson_avltree_map_rcu.h | 16 +++--- cds/container/details/bronson_avltree_base.h | 3 +- cds/container/impl/bronson_avltree_map_rcu.h | 58 ++++++++++---------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/cds/container/bronson_avltree_map_rcu.h b/cds/container/bronson_avltree_map_rcu.h index 8707c3ac..50725ec2 100644 --- a/cds/container/bronson_avltree_map_rcu.h +++ b/cds/container/bronson_avltree_map_rcu.h @@ -71,7 +71,7 @@ namespace cds { namespace container { - \p Traits - tree traits, default is \p bronson_avltree::traits It is possible to declare option-based tree with \p bronson_avltree::make_traits metafunction instead of \p Traits template argument. - + There is \ref cds_container_BronsonAVLTreeMap_rcu_ptr "a specialization" for "key -> value pointer" map. @note Before including you should include appropriate RCU header file, @@ -249,7 +249,7 @@ namespace cds { namespace container { //TODO: study how to pass a parameter pack to a lambda efficiently using perfect forwarding // see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#904 - this is what we need return base_class::do_update( key, key_comparator(), - [&args...]( node_type * pNode ) -> mapped_type * + [&args...]( node_type * pNode ) -> mapped_type * { assert( pNode->m_pValue.load( memory_model::memory_order_relaxed ) == nullptr ); CDS_UNUSED( pNode ); @@ -257,15 +257,15 @@ namespace cds { namespace container { }, update_flags::allow_insert ) == update_flags::result_inserted; -# else +# else // gcc 4.8 error: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226 // workaround (from http://stackoverflow.com/questions/14191989/how-do-i-use-variadic-perfect-forwarding-into-a-lambda) - auto f = std::bind( + auto f = std::bind( []( Args... args) -> mapped_type* { return cxx_allocator().New( std::move(args)...); }, std::forward(args)... ); return base_class::do_update( key, key_comparator(), - [&f]( node_type * pNode ) -> mapped_type * + [&f]( node_type * pNode ) -> mapped_type * { assert( pNode->m_pValue.load( memory_model::memory_order_relaxed ) == nullptr ); CDS_UNUSED( pNode ); @@ -307,7 +307,7 @@ namespace cds { namespace container { std::pair update( K const& key, Func func ) { int result = base_class::do_update( key, key_comparator(), - [&func]( node_type * pNode ) -> mapped_type* + [&func]( node_type * pNode ) -> mapped_type* { mapped_type * pVal = pNode->m_pValue.load( memory_model::memory_order_relaxed ); if ( !pVal ) { @@ -318,7 +318,7 @@ namespace cds { namespace container { func( false, pNode->m_key, *pVal ); return pVal; }, - update_flags::allow_insert | update_flags::allow_update + update_flags::allow_insert | update_flags::allow_update ); return std::make_pair( result != 0, (result & update_flags::result_inserted) != 0 ); } @@ -690,7 +690,7 @@ namespace cds { namespace container { void operator()( size_t nLevel, size_t hLeft, size_t hRight ); }; \endcode - where + where - \p nLevel - the level where the violation is found - \p hLeft - the height of left subtree - \p hRight - the height of right subtree diff --git a/cds/container/details/bronson_avltree_base.h b/cds/container/details/bronson_avltree_base.h index 9ce6a793..349e36ed 100644 --- a/cds/container/details/bronson_avltree_base.h +++ b/cds/container/details/bronson_avltree_base.h @@ -434,7 +434,7 @@ namespace cds { namespace container { Due the nature of GC schema the disposer may be called asynchronously. - \p opt::sync_monitor - @ref cds_sync_monitor "synchronization monitor" type for node-level locking, default is \p cds::sync::injecting_monitor - - \p bronson_avltree::relaxed_insert - enable (\p true) or disable (\p false, the default) + - \p bronson_avltree::relaxed_insert - enable (\p true) or disable (\p false, the default) @ref bronson_avltree::relaxed_insert "relaxed insertion" - \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 @@ -464,5 +464,4 @@ namespace cds { namespace container { }} // namespace cds::container - #endif // #ifndef CDSLIB_CONTAINER_DETAILS_BRONSON_AVLTREE_BASE_H diff --git a/cds/container/impl/bronson_avltree_map_rcu.h b/cds/container/impl/bronson_avltree_map_rcu.h index 955583a9..13347c5b 100644 --- a/cds/container/impl/bronson_avltree_map_rcu.h +++ b/cds/container/impl/bronson_avltree_map_rcu.h @@ -162,7 +162,7 @@ namespace cds { namespace container { return pNode->parent( order ); } - // RCU safe disposer + // RCU safe disposer class rcu_disposer { node_type * m_pRetiredList; ///< head of retired node list @@ -185,13 +185,13 @@ namespace cds { namespace container { pNode->m_pNextRemoved = m_pRetiredList; m_pRetiredList = pNode; } - + void dispose_value( mapped_type pVal ) { assert( m_pRetiredValue == nullptr ); m_pRetiredValue = pVal; } - + private: struct internal_disposer { @@ -204,7 +204,7 @@ namespace cds { namespace container { void clean() { assert( !gc::is_locked() ); - + // TODO: use RCU::batch_retire // Dispose nodes @@ -261,7 +261,7 @@ namespace cds { namespace container { assert( pNode->m_pValue.load( memory_model::memory_order_relaxed ) == nullptr ); CDS_UNUSED( pNode ); return pVal; - }, + }, update_flags::allow_insert ) == update_flags::result_inserted; } @@ -286,11 +286,11 @@ namespace cds { namespace container { std::pair update( K const& key, mapped_type pVal, bool bInsert = true ) { int result = do_update( key, key_comparator(), - [pVal]( node_type * ) -> mapped_type + [pVal]( node_type * ) -> mapped_type { return pVal; }, - update_flags::allow_update | (bInsert ? update_flags::allow_insert : 0) + update_flags::allow_update | (bInsert ? update_flags::allow_insert : 0) ); return std::make_pair( result != 0, (result & update_flags::result_inserted) != 0 ); } @@ -331,8 +331,8 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return do_remove( - key, + return do_remove( + key, cds::opt::details::make_comparator_from_less(), []( key_type const&, mapped_type pVal, rcu_disposer& disp ) -> bool { disp.dispose_value( pVal ); return true; } ); @@ -357,13 +357,13 @@ namespace cds { namespace container { template bool erase( K const& key, Func f ) { - return do_remove( - key, - key_comparator(), - [&f]( key_type const& key, mapped_type pVal, rcu_disposer& disp ) -> bool { + return do_remove( + key, + key_comparator(), + [&f]( key_type const& key, mapped_type pVal, rcu_disposer& disp ) -> bool { assert( pVal ); - f( key, *pVal ); - disp.dispose_value(pVal); + f( key, *pVal ); + disp.dispose_value(pVal); return true; } ); @@ -380,13 +380,13 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred, Func f ) { CDS_UNUSED( pred ); - return do_remove( - key, + return do_remove( + key, cds::opt::details::make_comparator_from_less(), - [&f]( key_type const& key, mapped_type pVal, rcu_disposer& disp ) -> bool { + [&f]( key_type const& key, mapped_type pVal, rcu_disposer& disp ) -> bool { assert( pVal ); - f( key, *pVal ); - disp.dispose_value(pVal); + f( key, *pVal ); + disp.dispose_value(pVal); return true; } ); @@ -584,7 +584,7 @@ namespace cds { namespace container { template bool find( K const& key, Func f ) { - return do_find( key, key_comparator(), + return do_find( key, key_comparator(), [&f]( node_type * pNode ) -> bool { assert( pNode != nullptr ); mapped_type pVal = pNode->m_pValue.load( memory_model::memory_order_relaxed ); @@ -608,7 +608,7 @@ namespace cds { namespace container { bool find_with( K const& key, Less pred, Func f ) { CDS_UNUSED( pred ); - return do_find( key, cds::opt::details::make_comparator_from_less(), + return do_find( key, cds::opt::details::make_comparator_from_less(), [&f]( node_type * pNode ) -> bool { assert( pNode != nullptr ); mapped_type pVal = pNode->m_pValue.load( memory_model::memory_order_relaxed ); @@ -617,7 +617,7 @@ namespace cds { namespace container { return true; } return false; - } + } ); } @@ -737,7 +737,7 @@ namespace cds { namespace container { void operator()( size_t nLevel, size_t hLeft, size_t hRight ); }; \endcode - where + where - \p nLevel - the level where the violation is found - \p hLeft - the height of left subtree - \p hRight - the height of right subtree @@ -1010,7 +1010,7 @@ namespace cds { namespace container { result = try_update( key, cmp, nFlags, funcUpdate, pChild, nChildVersion, disp ); else result = update_flags::retry; - } + } else { // the tree is empty if ( nFlags & update_flags::allow_insert ) { @@ -1265,7 +1265,7 @@ namespace cds { namespace container { if ( c_bRelaxedInsert ) { if ( pNode->version( memory_model::memory_order_acquire ) != nVersion - || child( pNode, nDir ) != nullptr ) + || child( pNode, nDir ) != nullptr ) { m_stat.onInsertRetry(); return update_flags::retry; @@ -1280,7 +1280,7 @@ namespace cds { namespace container { node_scoped_lock l( m_Monitor, *pNode ); if ( pNode->version( memory_model::memory_order_acquire ) != nVersion - || child( pNode, nDir ) != nullptr ) + || child( pNode, nDir ) != nullptr ) { if ( c_bRelaxedInsert ) { mapped_type pVal = pNew->m_pValue.load( memory_model::memory_order_relaxed ); @@ -1356,7 +1356,7 @@ namespace cds { namespace container { if ( !pNode->is_valued( atomics::memory_order_relaxed ) ) return update_flags::failed; - if ( child( pNode, left_child ) == nullptr || child( pNode, right_child ) == nullptr ) { + if ( child( pNode, left_child ) == nullptr || child( pNode, right_child ) == nullptr ) { node_type * pDamaged; mapped_type pOld; { @@ -1368,7 +1368,7 @@ namespace cds { namespace container { node_scoped_lock ln( m_Monitor, *pNode ); pOld = pNode->value( memory_model::memory_order_relaxed ); if ( !( pNode->version( memory_model::memory_order_acquire ) == nVersion - && pOld + && pOld && try_unlink_locked( pParent, pNode, disp ))) { return update_flags::retry; -- 2.34.1