From: David VaĊĦek Date: Tue, 27 May 2025 09:13:15 +0000 (+0200) Subject: ctl: after receiving the 'stop' command, interrupt the socket ctl thread immediately X-Git-Tag: v3.5.0~58^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7857bc50898a0b94586a7fd4b4c7c84aab338c21;p=thirdparty%2Fknot-dns.git ctl: after receiving the 'stop' command, interrupt the socket ctl thread immediately This enables quick shutdown without waiting for timeouts in the socket ctl thread. --- diff --git a/src/knot/ctl/threads.c b/src/knot/ctl/threads.c index 72ee2fc92a..555762028a 100644 --- a/src/knot/ctl/threads.c +++ b/src/knot/ctl/threads.c @@ -111,6 +111,10 @@ static void *ctl_process_thread(void *arg) pthread_mutex_lock(&ctx->mutex); ctx->ret = ret; + if (ret == KNOT_CTL_ESTOP) { + // Interrupt main ctl socket thread likely waiting in a syscall. + pthread_kill(ctx->socket_thr, SIGALRM); + } ctx->exclusive = exclusive; if (ctx->state == CONCURRENT_RUNNING) { // not KILLED ctx->state = CONCURRENT_IDLE;