mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 21:41:04 +00:00
Fix clamping physics threads
This commit is contained in:
parent
0d25656d81
commit
3d3cccb8e5
@ -330,8 +330,8 @@ namespace MWPhysics
|
||||
case LockingPolicy::ExclusiveLocksOnly:
|
||||
return 1;
|
||||
case LockingPolicy::AllowSharedLocks:
|
||||
return static_cast<unsigned>(std::max(
|
||||
getMaxBulletSupportedThreads(), Settings::Manager::getInt("async num threads", "Physics")));
|
||||
return static_cast<unsigned>(std::clamp(
|
||||
Settings::Manager::getInt("async num threads", "Physics"), 0, getMaxBulletSupportedThreads()));
|
||||
}
|
||||
|
||||
throw std::runtime_error("Unsupported LockingPolicy: "
|
||||
@ -372,6 +372,7 @@ namespace MWPhysics
|
||||
{
|
||||
if (mNumThreads >= 1)
|
||||
{
|
||||
Log(Debug::Info) << "Using " << mNumThreads << " async physics threads";
|
||||
for (unsigned i = 0; i < mNumThreads; ++i)
|
||||
mThreads.emplace_back([&] { worker(); });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user