projects
/
libcds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4eae12e
)
MSPriorityQueue: fixed typo, add more assertions
author
khizmax
<khizmax@gmail.com>
Fri, 29 Jul 2016 07:53:20 +0000
(10:53 +0300)
committer
khizmax
<khizmax@gmail.com>
Fri, 29 Jul 2016 07:53:20 +0000
(10:53 +0300)
cds/intrusive/mspriority_queue.h
patch
|
blob
|
history
diff --git
a/cds/intrusive/mspriority_queue.h
b/cds/intrusive/mspriority_queue.h
index 1cc0e39231a639c67ca04d672c66521d2140f935..2dda9d37883d976c90f877f035380de414bbe125 100644
(file)
--- a/
cds/intrusive/mspriority_queue.h
+++ b/
cds/intrusive/mspriority_queue.h
@@
-296,11
+296,13
@@
namespace cds { namespace intrusive {
node& refNode = m_Heap[i];
refNode.lock();
m_Lock.unlock();
node& refNode = m_Heap[i];
refNode.lock();
m_Lock.unlock();
+ assert( refNode.m_nTag == tag_type( Empty ));
+ assert( refNode.m_pVal == nullptr );
refNode.m_pVal = &val;
refNode.m_nTag = curId;
refNode.unlock();
refNode.m_pVal = &val;
refNode.m_nTag = curId;
refNode.unlock();
- // Move item towards top of
the heap while it has higher priority than
parent
+ // Move item towards top of
heap while it has a higher priority than its
parent
heapify_after_push( i, curId );
m_Stat.onPushSuccess();
heapify_after_push( i, curId );
m_Stat.onPushSuccess();
@@
-321,8
+323,7
@@
namespace cds { namespace intrusive {
m_Stat.onPopFailed();
return nullptr;
}
m_Stat.onPopFailed();
return nullptr;
}
- counter_type nBottom = m_ItemCounter.reversed_value();
- m_ItemCounter.dec();
+ counter_type nBottom = m_ItemCounter.dec();
assert( nBottom < m_Heap.capacity() );
assert( nBottom > 0 );
assert( nBottom < m_Heap.capacity() );
assert( nBottom > 0 );
@@
-508,7
+509,7
@@
namespace cds { namespace intrusive {
refRight.unlock();
}
refRight.unlock();
}
- // If child has higher priority tha
t
parent then swap
+ // If child has higher priority tha
n
parent then swap
// Otherwise stop
if ( cmp( *pChild->m_pVal, *pParent->m_pVal ) > 0 ) {
std::swap( pParent->m_nTag, pChild->m_nTag );
// Otherwise stop
if ( cmp( *pChild->m_pVal, *pParent->m_pVal ) > 0 ) {
std::swap( pParent->m_nTag, pChild->m_nTag );