From f00d136ab1523297fdf4707bbc5d40ec9d4f7afb Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sat, 23 Feb 2013 22:06:16 -0500 Subject: [PATCH] Fix selection of # threads, set default to 1 thread --- src/defaultsettings.cpp | 2 +- src/emerge.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 0e82c4e2..4307f761 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -187,7 +187,7 @@ void set_default_settings(Settings *settings) settings->setDefault("emergequeue_limit_total", "256"); settings->setDefault("emergequeue_limit_diskonly", ""); settings->setDefault("emergequeue_limit_generate", ""); - settings->setDefault("num_emerge_threads", ""); + settings->setDefault("num_emerge_threads", "1"); // physics stuff settings->setDefault("movement_acceleration_default", "3"); diff --git a/src/emerge.cpp b/src/emerge.cpp index dd97734c..dc2bb3e9 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -56,8 +56,7 @@ EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) { if (g_settings->get("num_emerge_threads").empty()) { int nprocs = porting::getNumberOfProcessors(); // leave a proc for the main thread and one for some other misc threads - if (nprocs > 2) - nthreads = nprocs - 2; + nthreads = (nprocs > 2) ? nthreads = nprocs - 2 : 1; } else { nthreads = g_settings->getU16("num_emerge_threads"); } -- 2.30.2