threadpool: Increase default for max_unused_threads

The default value for max_unused_threads has been 2 since 2012.
Core counts have gone up since then, and nowadays, it would be
much better to keep more of the threads alive for a little while.

This commit bumps the max_unused_threads default value to 8.

Fixes: #3545
This commit is contained in:
Matthias Clasen 2024-11-26 11:45:44 +00:00 committed by Philip Withnall
parent 2b155f86dd
commit 9f6441b278

View File

@ -99,7 +99,7 @@ static gint wakeup_thread_serial = 0;
/* Here all unused threads are waiting */ /* Here all unused threads are waiting */
static GAsyncQueue *unused_thread_queue = NULL; static GAsyncQueue *unused_thread_queue = NULL;
static gint unused_threads = 0; static gint unused_threads = 0;
static gint max_unused_threads = 2; static gint max_unused_threads = 8;
static gint kill_unused_threads = 0; static gint kill_unused_threads = 0;
static guint max_idle_time = 15 * 1000; static guint max_idle_time = 15 * 1000;
@ -985,7 +985,7 @@ g_thread_pool_wakeup_and_stop_all (GRealThreadPool *pool)
* If @max_threads is -1, no limit is imposed on the number * If @max_threads is -1, no limit is imposed on the number
* of unused threads. * of unused threads.
* *
* The default value is 2. * The default value is 8 since GLib 2.84. Previously the default value was 2.
*/ */
void void
g_thread_pool_set_max_unused_threads (gint max_threads) g_thread_pool_set_max_unused_threads (gint max_threads)