mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 23:15:43 +00:00
Merge branch 'fix_clamp_physics_threads' into 'master'
Fix clamping physics threads See merge request OpenMW/openmw!2792 (cherry picked from commitfbb00027d8
)3d3cccb8
Fix clamping physics threads
This commit is contained in:
parent
a7116aacbc
commit
5dfd2709b7
1 changed files with 3 additions and 2 deletions
|
@ -322,8 +322,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: "
|
||||
|
@ -363,6 +363,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…
Reference in a new issue