Commit a0d83966 by Tobias Fuchs

containers_cpp: added assertions and comments in WaitFreeMPMCQueue

parent 3fe8c475
...@@ -176,7 +176,7 @@ class WaitFreeMPMCQueue { ...@@ -176,7 +176,7 @@ class WaitFreeMPMCQueue {
* OperationDesc::NodeIndex (15 bit) minus one element * OperationDesc::NodeIndex (15 bit) minus one element
* required for sentinel node. * required for sentinel node.
*/ */
static const index_t QUEUE_SIZE_MAX = static_cast<index_t>(32767 - 1); static const index_t QUEUE_SIZE_MAX = static_cast<index_t>(0x3FFFFFFF - 1);
/** /**
* Number of guards per thread * Number of guards per thread
...@@ -186,7 +186,7 @@ class WaitFreeMPMCQueue { ...@@ -186,7 +186,7 @@ class WaitFreeMPMCQueue {
/** /**
* Null-pointer for hazard pointers * Null-pointer for hazard pointers
*/ */
static const index_t UndefinedGuard = 0; static const index_t UndefinedGuard = 0x3fffffff;
/** /**
* Helper class for operation descriptions. * Helper class for operation descriptions.
......
...@@ -62,20 +62,18 @@ PT_MAIN("Data Structures C++") { ...@@ -62,20 +62,18 @@ PT_MAIN("Data Structures C++") {
unsigned int max_threads = static_cast<unsigned int>( unsigned int max_threads = static_cast<unsigned int>(
2 * partest::TestSuite::GetDefaultNumThreads()); 2 * partest::TestSuite::GetDefaultNumThreads());
embb_thread_set_max_count(max_threads); embb_thread_set_max_count(max_threads);
#if 0
PT_RUN(PoolTest< WaitFreeArrayValuePool<int COMMA -1> >); PT_RUN(PoolTest< WaitFreeArrayValuePool<int COMMA -1> >);
PT_RUN(PoolTest< LockFreeTreeValuePool<int COMMA -1> >); PT_RUN(PoolTest< LockFreeTreeValuePool<int COMMA -1> >);
PT_RUN(HazardPointerTest); PT_RUN(HazardPointerTest);
PT_RUN(QueueTest< WaitFreeSPSCQueue< ::std::pair<size_t COMMA int> > >); PT_RUN(QueueTest< WaitFreeSPSCQueue< ::std::pair<size_t COMMA int> > >);
PT_RUN(QueueTest< LockFreeMPMCQueue< ::std::pair<size_t COMMA int> > PT_RUN(QueueTest< LockFreeMPMCQueue< ::std::pair<size_t COMMA int> >
COMMA true COMMA true >); COMMA true COMMA true >);
#endif
PT_RUN(QueueTest< WaitFreeMPMCQueue< ::std::pair<size_t COMMA int> > PT_RUN(QueueTest< WaitFreeMPMCQueue< ::std::pair<size_t COMMA int> >
COMMA true COMMA true >); COMMA true COMMA true >);
#if 0
PT_RUN(StackTest< LockFreeStack<int> >); PT_RUN(StackTest< LockFreeStack<int> >);
PT_RUN(ObjectPoolTest< LockFreeTreeValuePool<bool COMMA false > >); PT_RUN(ObjectPoolTest< LockFreeTreeValuePool<bool COMMA false > >);
PT_RUN(ObjectPoolTest< WaitFreeArrayValuePool<bool COMMA false> >); PT_RUN(ObjectPoolTest< WaitFreeArrayValuePool<bool COMMA false> >);
#endif
PT_EXPECT_EQ(embb_get_bytes_allocated(), static_cast<size_t>(0)); PT_EXPECT_EQ(embb_get_bytes_allocated(), static_cast<size_t>(0));
} }
...@@ -125,7 +125,7 @@ QueueTestOrderMPMC_Post() { ...@@ -125,7 +125,7 @@ QueueTestOrderMPMC_Post() {
for (size_t t = 0; for (size_t t = 0;
t < static_cast<size_t>(n_producers * n_producer_elements / 8); t < static_cast<size_t>(n_producers * n_producer_elements / 8);
++t) { ++t) {
PT_ASSERT_EQ_MSG(total_tally[t], 0xff, PT_ASSERT_EQ_MSG(static_cast<int>(total_tally[t]), 0xff,
"missing dequeued elements"); "missing dequeued elements");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment