logic: Use all available cores when setting indexer threads to 0 (issue #342)

This commit is contained in:
malte_langkabel
2017-04-11 13:42:20 +02:00
parent 498933d0aa
commit c78fe0d8d4
7 changed files with 64 additions and 5 deletions
+10 -1
View File
@@ -34,6 +34,7 @@
#include "utility/scheduling/TaskSetValue.h"
#include "utility/text/TextAccess.h"
#include "utility/utility.h"
#include "utility/utilityApp.h"
#include "utility/utilityString.h"
#include "utility/Version.h"
@@ -412,7 +413,15 @@ void Project::buildIndex(const std::set<FilePath>& filesToClean, bool fullRefres
if (indexerCommandList->size() > 0)
{
const size_t indexerThreadCount = ApplicationSettings::getInstance()->getIndexerThreadCount();
int indexerThreadCount = ApplicationSettings::getInstance()->getIndexerThreadCount();
if (indexerThreadCount <= 0)
{
indexerThreadCount = utility::getIdealThreadCount();
if (indexerThreadCount <= 0)
{
indexerThreadCount = 4; // setting to some fallback value
}
}
if (indexerThreadCount > 1)
{