]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: debug: make use of ha_tkill() and remove ifdefs
authorWilly Tarreau <w@1wt.eu>
Wed, 22 May 2019 06:46:59 +0000 (08:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 May 2019 09:50:48 +0000 (11:50 +0200)
This way we always signal the threads the same way.

src/debug.c

index 282c828df25f894ba04cf5d182b892a2918aa9c5..751d26be66fa3fdc1ba7316742a5c1363e41b56f 100644 (file)
@@ -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 */