bandk: store the worker name as part of 'struct bankd_worker'
Change-Id: Ife981a4d555f96b63aeaedf27c3ebe513191b0c7
This commit is contained in:
parent
00a9673ac2
commit
286a2beaa9
|
@ -46,6 +46,9 @@ struct bankd_worker {
|
||||||
/* back-pointer to bankd */
|
/* back-pointer to bankd */
|
||||||
struct bankd *bankd;
|
struct bankd *bankd;
|
||||||
|
|
||||||
|
/* name of the worker */
|
||||||
|
char *name;
|
||||||
|
|
||||||
/* thread number */
|
/* thread number */
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
/* worker thread state */
|
/* worker thread state */
|
||||||
|
|
|
@ -698,14 +698,9 @@ static void *worker_main(void *arg)
|
||||||
{
|
{
|
||||||
void *top_ctx;
|
void *top_ctx;
|
||||||
int rc;
|
int rc;
|
||||||
char worker_name[32];
|
|
||||||
|
|
||||||
g_worker = (struct bankd_worker *) arg;
|
g_worker = (struct bankd_worker *) arg;
|
||||||
|
|
||||||
/* set the thread name */
|
|
||||||
snprintf(worker_name, sizeof(worker_name), "bankd-worker(%u)", g_worker->num);
|
|
||||||
pthread_setname_np(pthread_self(), worker_name);
|
|
||||||
|
|
||||||
worker_set_state(g_worker, BW_ST_INIT);
|
worker_set_state(g_worker, BW_ST_INIT);
|
||||||
|
|
||||||
/* not permitted in multithreaded environment */
|
/* not permitted in multithreaded environment */
|
||||||
|
@ -713,6 +708,10 @@ static void *worker_main(void *arg)
|
||||||
top_ctx = talloc_named_const(NULL, 0, "top");
|
top_ctx = talloc_named_const(NULL, 0, "top");
|
||||||
talloc_asn1_ctx = talloc_named_const(top_ctx, 0, "asn1");
|
talloc_asn1_ctx = talloc_named_const(top_ctx, 0, "asn1");
|
||||||
|
|
||||||
|
/* set the thread name */
|
||||||
|
g_worker->name = talloc_asprintf(g_worker->tall_ctx, "bankd-worker(%u)", g_worker->num);
|
||||||
|
pthread_setname_np(pthread_self(), g_worker->name);
|
||||||
|
|
||||||
/* push cleanup helper */
|
/* push cleanup helper */
|
||||||
pthread_cleanup_push(&worker_cleanup, g_worker);
|
pthread_cleanup_push(&worker_cleanup, g_worker);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue