MINOR: wdt: do not depend on USE_THREAD
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Mar 2020 09:53:07 +0000 (10:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 May 2020 15:09:20 +0000 (17:09 +0200)
There is no reason for restricting the use of the watchdog to threads
anymore, as it works perfectly without threads as well.

(cherry picked from commit e58114e0e5e1ef1f67194bde0b0b8d159bd3ac48)
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/wdt.c

index ca31b54..ac8d951 100644 (file)
--- a/src/wdt.c
+++ b/src/wdt.c
@@ -26,7 +26,7 @@
  * It relies on timer_create() and timer_settime() which are only available in
  * this case.
  */
-#if defined(USE_THREAD) && defined(USE_RT) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME)
+#if defined(USE_RT) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME)
 
 /* Setup (or ping) the watchdog timer for thread <thr>. Returns non-zero on
  * success, zero on failure. It interrupts once per second of CPU time. It
@@ -113,9 +113,11 @@ void wdt_handler(int sig, siginfo_t *si, void *arg)
         * with the other thread interrupted exactly where it was running and
         * the current one not involved in this.
         */
+#ifdef USE_THREAD
        if (thr != tid)
                pthread_kill(ha_thread_info[thr].pthread, sig);
        else
+#endif
                ha_panic();
        return;