mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
fix deadlock in silent node removal
This commit is contained in:
parent
6a0c431562
commit
0579b18426
1 changed files with 8 additions and 6 deletions
|
@ -794,17 +794,19 @@ void NodeList::removeSilentNodes() {
|
|||
NodeHash::iterator nodeItem = _nodeHash.begin();
|
||||
|
||||
while (nodeItem != _nodeHash.end()) {
|
||||
nodeItem.value()->lock();
|
||||
|
||||
if ((usecTimestampNow() - nodeItem.value()->getLastHeardMicrostamp()) > NODE_SILENCE_THRESHOLD_USECS) {
|
||||
SharedNodePointer node = nodeItem.value();
|
||||
SharedNodePointer node = nodeItem.value();
|
||||
|
||||
node->lock();
|
||||
|
||||
if ((usecTimestampNow() - node->getLastHeardMicrostamp()) > NODE_SILENCE_THRESHOLD_USECS) {
|
||||
|
||||
// kill this node, don't lock - we already did it
|
||||
_nodeHash.erase(nodeItem);
|
||||
|
||||
// unlock the node
|
||||
node->unlock();
|
||||
}
|
||||
|
||||
// unlock the node
|
||||
node->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue