mirror of
https://github.com/overte-org/overte.git
synced 2025-04-10 13:32:30 +02:00
LocalID - Use tbb hash map instead of std one for better concurrency
This commit is contained in:
parent
f4bd1f5ed7
commit
2ba64e1115
2 changed files with 3 additions and 6 deletions
|
@ -696,7 +696,7 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
|
||||
auto oldSoloNode = previousSoloIt->second;
|
||||
|
||||
_localIDMap.erase(oldSoloNode->getLocalID());
|
||||
_localIDMap.unsafe_erase(oldSoloNode->getLocalID());
|
||||
_nodeHash.unsafe_erase(previousSoloIt);
|
||||
handleNodeKill(oldSoloNode);
|
||||
|
||||
|
@ -840,6 +840,7 @@ void LimitedNodeList::removeSilentNodes() {
|
|||
if (!node->isForcedNeverSilent()
|
||||
&& (usecTimestampNow() - node->getLastHeardMicrostamp()) > (NODE_SILENCE_THRESHOLD_MSECS * USECS_PER_MSEC)) {
|
||||
// call the NodeHash erase to get rid of this node
|
||||
_localIDMap.unsafe_erase(node->getLocalID());
|
||||
it = _nodeHash.unsafe_erase(it);
|
||||
|
||||
killedNodes.insert(node);
|
||||
|
@ -852,10 +853,6 @@ void LimitedNodeList::removeSilentNodes() {
|
|||
});
|
||||
|
||||
foreach(const SharedNodePointer& killedNode, killedNodes) {
|
||||
{
|
||||
QWriteLocker writeLock { &_nodeMutex };
|
||||
_localIDMap.erase(killedNode->getLocalID());
|
||||
}
|
||||
handleNodeKill(killedNode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -431,7 +431,7 @@ private slots:
|
|||
private:
|
||||
mutable QReadWriteLock _sessionUUIDLock;
|
||||
QUuid _sessionUUID;
|
||||
using LocalIDMapping = std::unordered_map<Node::LocalID, SharedNodePointer>;
|
||||
using LocalIDMapping = tbb::concurrent_unordered_map<Node::LocalID, SharedNodePointer>;
|
||||
LocalIDMapping _localIDMap;
|
||||
Node::LocalID _sessionLocalID { 0 };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue