From fade80d162df8aab49cb53688224daedae2f0f54 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 22 May 2019 08:46:59 +0200 Subject: [PATCH] CLEANUP: debug: make use of ha_tkill() and remove ifdefs This way we always signal the threads the same way. --- src/debug.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/debug.c b/src/debug.c index 282c828df..751d26be6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -360,11 +360,9 @@ static int debug_parse_cli_tkill(char **args, char *payload, struct appctx *appc if (*args[4]) sig = atoi(args[4]); -#if defined(USE_THREAD) if (thr) - pthread_kill(thread_info[thr-1].pthread, sig); + ha_tkill(thr - 1, sig); else -#endif raise(sig); return 1; } @@ -406,7 +404,6 @@ struct buffer *thread_dump_buffer = NULL; void ha_thread_dump_all_to_trash() { - __maybe_unused unsigned int thr; unsigned long old; while (1) { @@ -418,15 +415,7 @@ void ha_thread_dump_all_to_trash() thread_dump_buffer = &trash; thread_dump_tid = tid; - -#ifdef USE_THREAD - for (thr = 0; thr < global.nbthread; thr++) { - if (thr != tid) - pthread_kill(thread_info[thr].pthread, DEBUGSIG); - } -#endif - /* dump ourselves last */ - raise(DEBUGSIG); + ha_tkillall(DEBUGSIG); } /* handles DEBUGSIG to dump the state of the thread it's working on */