commit 35cfb56e7d4d7a950cb8e7b68c68b9cb81064e90
parent a9bc3198c8571bd0ceb074ceb8c94b283a6c6696
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Fri, 8 Sep 2023 12:02:17 +0300
mhd_threads: added new macro MHD_join_thread_tid_()
Diffstat:
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -3902,7 +3902,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! pos->thread_joined) &&
- (! MHD_join_thread_ (pos->tid.handle)) )
+ (! MHD_join_thread_tid_ (&pos->tid)) )
MHD_PANIC (_ ("Failed to join a thread.\n"));
#endif
#ifdef UPGRADE_SUPPORT
@@ -8288,7 +8288,7 @@ close_all_connections (struct MHD_Daemon *daemon)
* MHD_resume_connection() during finishing of "upgraded"
* thread. */
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
- if (! MHD_join_thread_ (pos->tid.handle))
+ if (! MHD_join_thread_tid_ (&pos->tid))
MHD_PANIC (_ ("Failed to join a thread.\n"));
pos->thread_joined = true;
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -8320,7 +8320,7 @@ close_all_connections (struct MHD_Daemon *daemon)
if (! pos->thread_joined)
{
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
- if (! MHD_join_thread_ (pos->tid.handle))
+ if (! MHD_join_thread_tid_ (&pos->tid))
MHD_PANIC (_ ("Failed to join a thread.\n"));
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
pos->thread_joined = true;
@@ -8458,7 +8458,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
mhd_assert (false); /* Should never happen */
}
- if (! MHD_join_thread_ (daemon->tid.handle))
+ if (! MHD_join_thread_tid_ (&daemon->tid))
{
MHD_PANIC (_ ("Failed to join a thread.\n"));
}
diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h
@@ -155,6 +155,9 @@ typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_;
(CloseHandle ( (thread)), ! 0) : 0 )
#endif
+#define MHD_join_thread_tid_(thread_handle_ID_ptr) \
+ (MHD_join_thread_((thread_handle_ID_ptr)->handle))
+
#if defined(MHD_USE_POSIX_THREADS)
/**
* Check whether provided thread ID matches current thread.