diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 5ac7c341..bc26b53f 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -5552,7 +5552,7 @@ thread_failed: | |||
5552 | 5552 | ||
5553 | /** | 5553 | /** |
5554 | * Close all connections for the daemon. | 5554 | * Close all connections for the daemon. |
5555 | * Must only be called when MHD_Daemon::shutdown was set to #MHD_YES. | 5555 | * Must only be called when MHD_Daemon::shutdown was set to true. |
5556 | * @remark To be called only from thread that process | 5556 | * @remark To be called only from thread that process |
5557 | * daemon's select()/poll()/etc. | 5557 | * daemon's select()/poll()/etc. |
5558 | * | 5558 | * |
@@ -5650,7 +5650,6 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
5650 | MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); | 5650 | MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); |
5651 | #endif | 5651 | #endif |
5652 | } | 5652 | } |
5653 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); | ||
5654 | 5653 | ||
5655 | /* now, collect per-connection threads */ | 5654 | /* now, collect per-connection threads */ |
5656 | if (used_thr_p_c) | 5655 | if (used_thr_p_c) |
@@ -5660,8 +5659,10 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
5660 | { | 5659 | { |
5661 | if (! pos->thread_joined) | 5660 | if (! pos->thread_joined) |
5662 | { | 5661 | { |
5662 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); | ||
5663 | if (! MHD_join_thread_ (pos->pid)) | 5663 | if (! MHD_join_thread_ (pos->pid)) |
5664 | MHD_PANIC (_("Failed to join a thread\n")); | 5664 | MHD_PANIC (_("Failed to join a thread\n")); |
5665 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | ||
5665 | pos->thread_joined = true; | 5666 | pos->thread_joined = true; |
5666 | /* The thread may have concurrently modified the DLL, | 5667 | /* The thread may have concurrently modified the DLL, |
5667 | need to restart from the beginning */ | 5668 | need to restart from the beginning */ |
@@ -5671,6 +5672,7 @@ close_all_connections (struct MHD_Daemon *daemon) | |||
5671 | pos = pos->next; | 5672 | pos = pos->next; |
5672 | } | 5673 | } |
5673 | } | 5674 | } |
5675 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); | ||
5674 | 5676 | ||
5675 | #ifdef UPGRADE_SUPPORT | 5677 | #ifdef UPGRADE_SUPPORT |
5676 | /* Finished threads with "upgraded" connections need to be moved | 5678 | /* Finished threads with "upgraded" connections need to be moved |