bankd_main: Set the pthread name for easier debugging

Change-Id: Ib1bf2b392ee161ba0d2d01bec927c2c0293a8f3b
This commit is contained in:
Harald Welte 2018-10-03 21:03:34 +02:00
parent f94b9ee67b
commit 31c9eca75a
1 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,5 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@ -459,6 +461,11 @@ static void *worker_main(void *arg)
struct bankd_worker *worker = (struct bankd_worker *) arg;
void *top_ctx;
int rc;
char worker_name[32];
/* set the thread name */
snprintf(worker_name, sizeof(worker_name), "bankd-worker(%u)", worker->num);
pthread_setname_np(pthread_self(), worker_name);
worker_set_state(worker, BW_ST_INIT);