diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-12 01:05:32 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-12 01:05:32 -0400 |
commit | 4db920ce8cce46cee404c7d7870fac8eed2e7689 (patch) | |
tree | 6ef833c1add3560805992e814aac9ab2b4f00aa8 | |
parent | a490f2ebd9dbb4b0fb395a2b93f727c56afda218 (diff) |
better thread names
-rw-r--r-- | src/multipart-replace-http-server.c | 6 | ||||
-rw-r--r-- | src/wg.c | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/multipart-replace-http-server.c b/src/multipart-replace-http-server.c index bc188b8..792a26d 100644 --- a/src/multipart-replace-http-server.c +++ b/src/multipart-replace-http-server.c @@ -72,9 +72,9 @@ void stop(int sig) { void *reader_thread(void *args_anon) { struct reader_thread_args *args = args_anon; - char *name = alloca(strlen("read ")+strlen(args->filename)+1); - strcpy(name, "read "); - strcpy(&name[strlen("read ")], args->filename); + char name[16]; + strncpy(name, args->filename, sizeof(name)); + name[15] = '\0'; pthread_setname_np(pthread_self(), name); debug("starting thread: %s", name); @@ -28,6 +28,7 @@ static void *wg_gc(void *wg_anon) { + pthread_setname_np(pthread_self(), "wg_gc"); struct wg *wg = wg_anon; pthread_t thread; |