mhd_threads: added new macro MHD_join_thread_tid_()

This commit is contained in:
Evgeny Grin (Karlson2k)
2023-09-08 12:04:09 +03:00
parent a9bc3198c8
commit 35cfb56e7d
2 changed files with 7 additions and 4 deletions
+4 -4
View File
@@ -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"));
}
+3
View File
@@ -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.