diff options
| author | Quentin Young <qlyoung@nvidia.com> | 2020-09-15 20:11:39 -0400 |
|---|---|---|
| committer | Quentin Young <qlyoung@nvidia.com> | 2020-09-15 20:16:56 -0400 |
| commit | 7ffcd8bd2daf8942796858a7b325dad9c1cefffc (patch) | |
| tree | 0d6d6b4ebe202c8666caf2be51c16fcc0d907469 /lib/thread.c | |
| parent | eac139f8f26315076d2c5fd94e7ac2fe322be084 (diff) | |
lib: set threadmaster name to 'default' if none
And also include the name of the threadmaster in its event hash name.
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
Diffstat (limited to 'lib/thread.c')
| -rw-r--r-- | lib/thread.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/thread.c b/lib/thread.c index 19e4827283..db35a3f031 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -438,7 +438,8 @@ struct thread_master *thread_master_create(const char *name) pthread_cond_init(&rv->cancel_cond, NULL); /* Set name */ - rv->name = name ? XSTRDUP(MTYPE_THREAD_MASTER, name) : NULL; + name = name ? name : "default"; + rv->name = XSTRDUP(MTYPE_THREAD_MASTER, name); /* Initialize I/O task data structures */ getrlimit(RLIMIT_NOFILE, &limit); @@ -449,10 +450,13 @@ struct thread_master *thread_master_create(const char *name) rv->write = XCALLOC(MTYPE_THREAD_POLL, sizeof(struct thread *) * rv->fd_limit); + char tmhashname[strlen(name) + 32]; + snprintf(tmhashname, sizeof(tmhashname), "%s - threadmaster event hash", + name); rv->cpu_record = hash_create_size( 8, (unsigned int (*)(const void *))cpu_record_hash_key, (bool (*)(const void *, const void *))cpu_record_hash_cmp, - "Thread Hash"); + tmhashname); thread_list_init(&rv->event); thread_list_init(&rv->ready); |
