mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-04 04:20:51 +00:00
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.
This commit is contained in:
parent
f1f1703441
commit
a73ffc25c3
@ -298,9 +298,15 @@ namespace DetourNavigator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == UpdateNavMeshStatus::removed || status == UpdateNavMeshStatus::lost)
|
if (status == UpdateNavMeshStatus::removed || status == UpdateNavMeshStatus::lost)
|
||||||
|
{
|
||||||
|
const std::scoped_lock lock(mMutex);
|
||||||
mPresentTiles.erase(std::make_tuple(job.mAgentHalfExtents, job.mChangedTile));
|
mPresentTiles.erase(std::make_tuple(job.mAgentHalfExtents, job.mChangedTile));
|
||||||
|
}
|
||||||
else if (isSuccess(status) && status != UpdateNavMeshStatus::ignored)
|
else if (isSuccess(status) && status != UpdateNavMeshStatus::ignored)
|
||||||
|
{
|
||||||
|
const std::scoped_lock lock(mMutex);
|
||||||
mPresentTiles.insert(std::make_tuple(job.mAgentHalfExtents, job.mChangedTile));
|
mPresentTiles.insert(std::make_tuple(job.mAgentHalfExtents, job.mChangedTile));
|
||||||
|
}
|
||||||
|
|
||||||
const auto finish = std::chrono::steady_clock::now();
|
const auto finish = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user