From 59825c92e067eb9e06d991fc7939e81fff0b444e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 22 Nov 2022 12:35:40 +0000 Subject: [PATCH] gthreadpool: Mark an explicit leak as to be ignored MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This thread is created once during the process’ lifetime and cannot be destroyed and recreated, as the thread scheduler settings might have changed since then. Mark the leak as explicit, mostly for documentation purposes — but it might quieten some static analysers. Signed-off-by: Philip Withnall Coverity CID: #1474614 --- glib/gthreadpool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/glib/gthreadpool.c b/glib/gthreadpool.c index 0d656f072..5a8876b77 100644 --- a/glib/gthreadpool.c +++ b/glib/gthreadpool.c @@ -30,6 +30,7 @@ #include "gasyncqueue.h" #include "gasyncqueueprivate.h" +#include "glib-private.h" #include "gmain.h" #include "gtestutils.h" #include "gthreadprivate.h" @@ -649,9 +650,12 @@ g_thread_pool_new_full (GFunc func, } else { + GThread *pool_spawner = NULL; + spawn_thread_queue = g_async_queue_new (); g_cond_init (&spawn_thread_cond); - g_thread_new ("pool-spawner", g_thread_pool_spawn_thread, NULL); + pool_spawner = g_thread_new ("pool-spawner", g_thread_pool_spawn_thread, NULL); + g_ignore_leak (pool_spawner); } } G_UNLOCK (init);