From e8b3c4126e0ba5ade5ecdfbd325d82feb2f24ea3 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sun, 21 Jul 2024 18:26:43 +0200 Subject: [PATCH] Fixed shutdown of the daemon --- src/mhd2/daemon_start.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mhd2/daemon_start.c b/src/mhd2/daemon_start.c index 9c4cd9fe..4df1a5f3 100644 --- a/src/mhd2/daemon_start.c +++ b/src/mhd2/daemon_start.c @@ -2548,6 +2548,8 @@ stop_individual_daemon_thread (struct MHD_Daemon *restrict d) (mhd_DAEMON_STATE_STARTING == d->state)); mhd_assert (mhd_thread_handle_ID_is_valid_handle (d->threading.tid)); + d->threading.stop_requested = true; + mhd_daemon_trigger_itc (d); if (! mhd_thread_handle_ID_join_thread (d->threading.tid)) { @@ -2583,6 +2585,7 @@ stop_worker_pool_threads (struct MHD_Daemon *restrict d, /* Trigger all threads */ for (i = num_workers - 1; num_workers > i; --i) { /* Note: loop exits after underflow of 'i' */ + d->threading.hier.pool.workers[i].threading.stop_requested = true; mhd_assert (mhd_ITC_IS_VALID ( \ d->threading.hier.pool.workers[i].threading.itc)); mhd_daemon_trigger_itc (d->threading.hier.pool.workers + i);