mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 08:26:14 +01:00
Merge branch 'thread-pool-initialization-logic' into 'master'
Fix initialization logic of GThreadPool if the first created pool is an exclusive one Closes #2012 See merge request GNOME/glib!1340
This commit is contained in:
commit
93607c4137
@ -579,8 +579,8 @@ g_thread_pool_new (GFunc func,
|
|||||||
|
|
||||||
G_LOCK (init);
|
G_LOCK (init);
|
||||||
if (!unused_thread_queue)
|
if (!unused_thread_queue)
|
||||||
{
|
|
||||||
unused_thread_queue = g_async_queue_new ();
|
unused_thread_queue = g_async_queue_new ();
|
||||||
|
|
||||||
/* For the very first non-exclusive thread-pool we remember the thread
|
/* For the very first non-exclusive thread-pool we remember the thread
|
||||||
* scheduler settings of the thread creating the pool, if supported by
|
* scheduler settings of the thread creating the pool, if supported by
|
||||||
* the GThread implementation. This is then used for making sure that
|
* the GThread implementation. This is then used for making sure that
|
||||||
@ -603,7 +603,7 @@ g_thread_pool_new (GFunc func,
|
|||||||
* are created immediately below and are running forever, so they will
|
* are created immediately below and are running forever, so they will
|
||||||
* automatically inherit the scheduler settings from this very thread.
|
* automatically inherit the scheduler settings from this very thread.
|
||||||
*/
|
*/
|
||||||
if (!exclusive)
|
if (!exclusive && !have_shared_thread_scheduler_settings && !spawn_thread_queue)
|
||||||
{
|
{
|
||||||
if (g_thread_get_scheduler_settings (&shared_thread_scheduler_settings))
|
if (g_thread_get_scheduler_settings (&shared_thread_scheduler_settings))
|
||||||
{
|
{
|
||||||
@ -616,7 +616,6 @@ g_thread_pool_new (GFunc func,
|
|||||||
g_thread_new ("pool-spawner", g_thread_pool_spawn_thread, NULL);
|
g_thread_new ("pool-spawner", g_thread_pool_spawn_thread, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
G_UNLOCK (init);
|
G_UNLOCK (init);
|
||||||
|
|
||||||
if (retval->pool.exclusive)
|
if (retval->pool.exclusive)
|
||||||
|
Loading…
Reference in New Issue
Block a user