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:
const size_t nTotalWriters = s_nProducerThreadCount;
value_type v;
while ( true ) {
- if ( m_Queue.pop( v ) ) {
+ if ( m_Queue.pop( v )) {
++m_nPopped;
if ( v.nWriterNo < nTotalWriters )
m_WriterData[ v.nWriterNo ].push_back( v.nNo );
++m_nPopEmpty;
if ( s_nProducerDone.load() >= nTotalWriters ) {
- if ( m_Queue.empty() )
+ if ( m_Queue.empty())
break;
}
}
nTotalPops += consumer.m_nPopped;
nPopFalse += consumer.m_nPopEmpty;
arrConsumer.push_back( &consumer );
- EXPECT_EQ( consumer.m_nBadWriter, 0 ) << "consumer_thread_no " << i;
+ EXPECT_EQ( consumer.m_nBadWriter, 0u ) << "consumer_thread_no " << i;
size_t nPopped = 0;
for ( size_t n = 0; n < s_nProducerThreadCount; ++n )
Producer& producer = static_cast<Producer&>( thr );
nPushFailed += producer.m_nPushFailed;
- EXPECT_EQ( producer.m_nPushFailed, 0 ) << "producer_thread_no " << i;
+ EXPECT_EQ( producer.m_nPushFailed, 0u ) << "producer_thread_no " << i;
}
}
EXPECT_EQ( nTotalPops, nPoppedItems );
EXPECT_EQ( nTotalPops + nPostTestPops, s_nQueueSize ) << "nTotalPops=" << nTotalPops << ", nPostTestPops=" << nPostTestPops;
- EXPECT_TRUE( q.empty() );
+ EXPECT_TRUE( q.empty());
// Test consistency of popped sequence
for ( size_t nWriter = 0; nWriter < s_nProducerThreadCount; ++nWriter ) {
arrData.push_back( *it );
}
- std::sort( arrData.begin(), arrData.end() );
+ std::sort( arrData.begin(), arrData.end());
for ( size_t i=1; i < arrData.size(); ++i ) {
EXPECT_EQ( arrData[i - 1] + 1, arrData[i] ) << "producer=" << nWriter;
}
- EXPECT_EQ( arrData[0], 0 ) << "producer=" << nWriter;
+ EXPECT_EQ( arrData[0], 0u ) << "producer=" << nWriter;
EXPECT_EQ( arrData[arrData.size() - 1], m_nThreadPushCount - 1 ) << "producer=" << nWriter;
}
}
}
public:
- static void SetUpTestCase()\r
- {\r
- cds_test::config const& cfg = get_config( "queue_push_pop" );\r
-\r
+ static void SetUpTestCase()
+ {
+ cds_test::config const& cfg = get_config( "queue_push_pop" );
+
s_nConsumerThreadCount = cfg.get_size_t( "ConsumerCount", s_nConsumerThreadCount );
s_nProducerThreadCount = cfg.get_size_t( "ProducerCount", s_nProducerThreadCount );
s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize );
- if ( s_nConsumerThreadCount == 0 )
+ if ( s_nConsumerThreadCount == 0u )
s_nConsumerThreadCount = 1;
- if ( s_nProducerThreadCount == 0 )
+ if ( s_nProducerThreadCount == 0u )
s_nProducerThreadCount = 1;
- if ( s_nQueueSize == 0 )
+ if ( s_nQueueSize == 0u )
s_nQueueSize = 1000;
- }\r
-\r
- //static void TearDownTestCase();\r
+ }
+
+ //static void TearDownTestCase();
};
CDSSTRESS_MSQueue( queue_push_pop )