diff options
| author | root <[email protected]> | 2023-11-08 08:31:32 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2023-11-08 08:31:32 +0000 |
| commit | 244ec2b503056e905d1f184edd019ff0be483bed (patch) | |
| tree | 4c8f3c63117213561ad05740425416ab3718cf60 /shaping/src/main.cpp | |
| parent | 7ce4f3abd8ae83c95bee215c272b354d1a6143e7 (diff) | |
add name for worker thread
Diffstat (limited to 'shaping/src/main.cpp')
| -rw-r--r-- | shaping/src/main.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/shaping/src/main.cpp b/shaping/src/main.cpp index 8143bce..b7807f7 100644 --- a/shaping/src/main.cpp +++ b/shaping/src/main.cpp @@ -4,6 +4,7 @@ #include <unistd.h> #include <assert.h> #include <signal.h> +#include <sys/prctl.h> #include <jemalloc/jemalloc.h> #include "log.h" @@ -19,8 +20,12 @@ static int quit = 0; static void *shaper_thread_loop(void *data) { + char thread_name[16] = {0}; struct shaping_thread_ctx *ctx = (struct shaping_thread_ctx *)data; + snprintf(thread_name, sizeof(thread_name), "shape-work-%d", ctx->thread_index); + prctl(PR_SET_NAME, (unsigned long long)thread_name, NULL, NULL, NULL); + if (marsio_thread_init(ctx->marsio_info->instance) != 0) { LOG_ERROR("%s: marsio_thread_init failed", LOG_TAG_SHAPING); return NULL; |
