Fix selection of # threads, set default to 1 thread

pull/482/merge
kwolekr 2013-02-23 22:06:16 -05:00
parent 28c50c16cd
commit f00d136ab1
2 changed files with 2 additions and 3 deletions

View File

@ -187,7 +187,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("emergequeue_limit_total", "256"); settings->setDefault("emergequeue_limit_total", "256");
settings->setDefault("emergequeue_limit_diskonly", ""); settings->setDefault("emergequeue_limit_diskonly", "");
settings->setDefault("emergequeue_limit_generate", ""); settings->setDefault("emergequeue_limit_generate", "");
settings->setDefault("num_emerge_threads", ""); settings->setDefault("num_emerge_threads", "1");
// physics stuff // physics stuff
settings->setDefault("movement_acceleration_default", "3"); settings->setDefault("movement_acceleration_default", "3");

View File

@ -56,8 +56,7 @@ EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) {
if (g_settings->get("num_emerge_threads").empty()) { if (g_settings->get("num_emerge_threads").empty()) {
int nprocs = porting::getNumberOfProcessors(); int nprocs = porting::getNumberOfProcessors();
// leave a proc for the main thread and one for some other misc threads // leave a proc for the main thread and one for some other misc threads
if (nprocs > 2) nthreads = (nprocs > 2) ? nthreads = nprocs - 2 : 1;
nthreads = nprocs - 2;
} else { } else {
nthreads = g_settings->getU16("num_emerge_threads"); nthreads = g_settings->getU16("num_emerge_threads");
} }