Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "map_type.h"
, nUpdateCall( s.nUpdateCall )
, bInitialized( s.bInitialized.load(atomics::memory_order_relaxed))
, threadId( cds::OS::get_current_thread_id())
+ , m_access()
{}
// boost::container::flat_map requires operator =
+ // cppcheck-suppress operatorEqVarError
value_type& operator=( value_type const& v )
{
nKey = v.nKey;
nData = v.nData;
nUpdateCall = v.nUpdateCall;
+ threadId = v.threadId;
bInitialized.store(v.bInitialized.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed);
return *this;
operator()( bNew, val.first, val.second );
}
- // For FeldmanHashMap
+ // For FeldmanHashMap, IterableList
template <typename Val>
void operator()( Val& cur, Val * old )
{
size_t nFailedItem;
value_container()
- : nSuccessItem(0)
+ : nKeyExpected()
+ , nSuccessItem(0)
, nFailedItem(0)
{}
};
cds_test::thread_pool& pool = get_pool();
pool.add( new inserter( pool, testMap ), s_nInsertThreadCount );
pool.add( new deleter( pool, testMap ), s_nDeleteThreadCount );
- pool.add( new updater( pool, testMap ), s_nUpdateThreadCount );
+ if ( s_nUpdateThreadCount )
+ pool.add( new updater( pool, testMap ), s_nUpdateThreadCount );
propout() << std::make_pair( "insert_thread_count", s_nInsertThreadCount )
<< std::make_pair( "delete_thread_count", s_nDeleteThreadCount )
for ( size_t i = 0; i < pool.size(); ++i ) {
cds_test::thread& thr = pool.get( i );
- switch ( thr.type() ) {
+ switch ( thr.type()) {
case insert_thread:
{
inserter& t = static_cast<inserter&>( thr );
<< std::make_pair( "update_failed", nUpdateFailed )
<< std::make_pair( "update_functor_create", nEnsFuncCreated )
<< std::make_pair( "update_functor_modify", nEnsFuncModified )
- << std::make_pair( "finish_map_size", testMap.size() );
+ << std::make_pair( "finish_map_size", testMap.size());
- EXPECT_EQ( nDelValueFailed, 0 );
+ EXPECT_EQ( nDelValueFailed, 0u );
EXPECT_EQ( nDelValueSuccess, nDeleteSuccess );
- EXPECT_EQ( nUpdateFailed, 0 );
+ EXPECT_EQ( nUpdateFailed, 0u );
EXPECT_EQ( nUpdateCreated + nUpdateModified, nEnsFuncCreated + nEnsFuncModified );
// nInsFuncCalled is call count of insert functor
testMap.erase( nItem );
EXPECT_TRUE( testMap.empty());
+ EXPECT_EQ( testMap.size(), 0u );
additional_check( testMap );
print_stat( propout(), testMap );
Map testMap( *this );
do_test( testMap );
}
+
+ template <class Map>
+ void run_test2()
+ {
+ Map testMap( *this );
+ do_test( testMap );
+
+ if ( testMap.size() != 0 ) {
+ for ( auto it = testMap.begin(); it != testMap.end(); ++it ) {
+ std::cout << "key=" << it->first << std::endl;
+ }
+ }
+ }
};
class Map_InsDel_func_LF: public Map_InsDel_func
Map_InsDel_func::run_test<Set>();
}
+ template <class Set>
+ void run_test2()
+ {
+ s_nLoadFactor = GetParam();
+ propout() << std::make_pair( "load_factor", s_nLoadFactor );
+ Map_InsDel_func::run_test2<Set>();
+ }
+
static std::vector<size_t> get_load_factors();
};