pipewire: data-loop: set thread name

Set the name of the thread running the data loop to "pw-data-loop"
for easier identification in debuggers, htop, etc.
This commit is contained in:
Barnabás Pőcze 2023-12-12 16:38:36 +01:00 committed by Wim Taymans
parent 0c1ee5f01d
commit 32ee81d977

View file

@ -188,7 +188,12 @@ int pw_data_loop_start(struct pw_data_loop *loop)
if ((utils = loop->thread_utils) == NULL)
utils = pw_thread_utils_get();
thr = spa_thread_utils_create(utils, NULL, do_loop, loop);
static const struct spa_dict_item items[] = {
{ SPA_KEY_THREAD_NAME, "pw-data-loop" },
};
thr = spa_thread_utils_create(utils, &SPA_DICT_INIT_ARRAY(items), do_loop, loop);
loop->thread = (pthread_t)thr;
if (thr == NULL) {
pw_log_error("%p: can't create thread: %m", loop);