core: Make aggregated objects thread-safe

This commit is contained in:
F5
2022-10-19 21:18:44 +08:00
parent ba81313570
commit 34b8e39172

View File

@@ -163,6 +163,7 @@ Object::DoGetObject (TypeId tid) const
} }
if (cur == tid) if (cur == tid)
{ {
#ifndef NS3_MTP
// This is an attempt to 'cache' the result of this lookup. // This is an attempt to 'cache' the result of this lookup.
// the idea is that if we perform a lookup for a TypeId on this object, // the idea is that if we perform a lookup for a TypeId on this object,
// we are likely to perform the same lookup later so, we make sure // we are likely to perform the same lookup later so, we make sure
@@ -173,6 +174,7 @@ Object::DoGetObject (TypeId tid) const
current->m_getObjectCount++; current->m_getObjectCount++;
// then, update the sort // then, update the sort
UpdateSortedArray (m_aggregates, i); UpdateSortedArray (m_aggregates, i);
#endif
// finally, return the match // finally, return the match
return const_cast<Object *> (current); return const_cast<Object *> (current);
} }