Skip to content

Commit

Permalink
Settings: Do not load the thread limit if it is too high for the CPU
Browse files Browse the repository at this point in the history
In case the person changes CPU.
  • Loading branch information
aldelaro5 committed Jul 7, 2018
1 parent 2ea0dce commit 2ea54c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/GUI/Settings/SConfig.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "SConfig.h"

#include <thread>

SConfig::SConfig()
{
m_settings = new QSettings("settings.ini", QSettings::IniFormat);
Expand All @@ -25,7 +27,10 @@ QString SConfig::gameGroupStrForStarter(const GUICommon::starter starter) const

int SConfig::getThreadLimit() const
{
return m_settings->value("generalSettings/CPUThreadLimit", 0).toInt();
unsigned int threadLimit = m_settings->value("generalSettings/CPUThreadLimit", 0).toUInt();
if (threadLimit != 0 && threadLimit >= std::thread::hardware_concurrency())
return 0;
return threadLimit;
}

int SConfig::getPredictionTime() const
Expand Down

0 comments on commit 2ea54c5

Please sign in to comment.