Fix selection of # threads, set default to 1 thread
authorkwolekr <mirrorisim@gmail.com>
Sun, 24 Feb 2013 03:06:16 +0000 (22:06 -0500)
committerkwolekr <mirrorisim@gmail.com>
Tue, 26 Feb 2013 04:11:00 +0000 (23:11 -0500)
src/defaultsettings.cpp
src/emerge.cpp

index 0e82c4e2f91b7a57a9b09283ea572f0320bdd3eb..4307f761020996b106457a75b319475725a7de7c 100644 (file)
@@ -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");
index dd97734c56e5dab68d40a08291f792095ce4e288..dc2bb3e994f6412973f33be7c48978df9b8e3de5 100644 (file)
@@ -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");
        }