mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
gthreadpool: Include prgname in thread name
All pool threads are named "pool" and this a bit annoying when looking at system-wide traces or statistics for a system where several applications use thread pools. Include the prgname in the thread names to get a better default name. The total length including the "pool-" prefix is limited to 16 bytes in order for it to work on all systems. Change-Id: I473a9f534c4630f3e81da72ff96d8f593c60efac
This commit is contained in:
parent
da8f1c6ac3
commit
c50bdf07e8
@ -31,6 +31,7 @@
|
|||||||
#include "gmain.h"
|
#include "gmain.h"
|
||||||
#include "gtestutils.h"
|
#include "gtestutils.h"
|
||||||
#include "gtimer.h"
|
#include "gtimer.h"
|
||||||
|
#include "gutils.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:thread_pools
|
* SECTION:thread_pools
|
||||||
@ -401,10 +402,15 @@ g_thread_pool_start_thread (GRealThreadPool *pool,
|
|||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
const gchar *prgname = g_get_prgname ();
|
||||||
|
gchar name[16] = "pool";
|
||||||
GThread *thread;
|
GThread *thread;
|
||||||
|
|
||||||
|
if (prgname)
|
||||||
|
g_snprintf (name, sizeof (name), "pool-%s", prgname);
|
||||||
|
|
||||||
/* No thread was found, we have to start a new one */
|
/* No thread was found, we have to start a new one */
|
||||||
thread = g_thread_try_new ("pool", g_thread_pool_thread_proxy, pool, error);
|
thread = g_thread_try_new (name, g_thread_pool_thread_proxy, pool, error);
|
||||||
|
|
||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user