- thread_pool = g_thread_pool_new ( (GFunc) thread_helper, NULL, max_threads, FALSE, NULL );
+ thread_pool_remote = g_thread_pool_new ( (GFunc) thread_helper, NULL, max_threads, FALSE, NULL );
+
+ if ( a_settings_get_integer ( VIK_SETTINGS_BACKGROUND_MAX_THREADS_LOCAL, &maxt ) )
+ max_threads = maxt;
+ else {
+ guint cpus = util_get_number_of_cpus ();
+ max_threads = cpus > 1 ? cpus-1 : 1; // Don't use all available CPUs!
+ }
+
+ thread_pool_local = g_thread_pool_new ( (GFunc) thread_helper, NULL, max_threads, FALSE, NULL );