Add missing synchronization for present tiles modification

insert/erase can be done from multiple threads simultaneously. mMutex is
already used to synchronize reads so use it for writes too.
pull/593/head
elsid 4 years ago
parent f1f1703441
commit a73ffc25c3
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -298,9 +298,15 @@ namespace DetourNavigator
}
if (status == UpdateNavMeshStatus::removed || status == UpdateNavMeshStatus::lost)
{
const std::scoped_lock lock(mMutex);
mPresentTiles.erase(std::make_tuple(job.mAgentHalfExtents, job.mChangedTile));
}
else if (isSuccess(status) && status != UpdateNavMeshStatus::ignored)
{
const std::scoped_lock lock(mMutex);
mPresentTiles.insert(std::make_tuple(job.mAgentHalfExtents, job.mChangedTile));
}
const auto finish = std::chrono::steady_clock::now();

Loading…
Cancel
Save