libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit e55b0418ecae1aea289e8197ef0850690c5fa3f1
parent 3b0a9d19d13b5ac77714190da439d8a4c2c56736
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Fri,  8 Sep 2023 11:10:51 +0300

mhd_threads: renamed one macro for clarity

Diffstat:
Msrc/microhttpd/connection.c | 10+++++-----
Msrc/microhttpd/daemon.c | 24++++++++++++------------
Msrc/microhttpd/mhd_threads.h | 11++++++-----
Msrc/microhttpd/response.c | 2+-
4 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -1151,7 +1151,7 @@ MHD_connection_close_ (struct MHD_Connection *connection, mhd_assert (! connection->suspended); #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (connection->pid) ); + MHD_thread_ID_is_current_thread_ (connection->pid) ); #endif /* MHD_USE_THREADS */ if ( (NULL != daemon->notify_completed) && (connection->rq.client_aware) ) @@ -1195,7 +1195,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); #endif /* MHD_USE_THREADS */ if (0 == (daemon->options & MHD_USE_TLS)) @@ -6248,7 +6248,7 @@ cleanup_connection (struct MHD_Connection *connection) struct MHD_Daemon *daemon = connection->daemon; #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (connection->pid) ); + MHD_thread_ID_is_current_thread_ (connection->pid) ); mhd_assert (NULL == daemon->worker_pool); #endif /* MHD_USE_THREADS */ @@ -6455,7 +6455,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) enum MHD_Result ret; #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (connection->pid) ); + MHD_thread_ID_is_current_thread_ (connection->pid) ); #endif /* MHD_USE_THREADS */ /* 'daemon' is not used if epoll is not available and asserts are disabled */ (void) daemon; /* Mute compiler warning */ @@ -7139,7 +7139,7 @@ MHD_queue_response (struct MHD_Connection *connection, #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) if ( (! connection->suspended) && (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && - (! MHD_thread_ID_match_current_ (connection->pid)) ) + (! MHD_thread_ID_is_current_thread_ (connection->pid)) ) { #ifdef HAVE_MESSAGES MHD_DLOG (daemon, diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1322,7 +1322,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (connection->pid) ); + MHD_thread_ID_is_current_thread_ (connection->pid) ); #endif /* MHD_USE_THREADS */ if (daemon->shutdown) { @@ -1670,7 +1670,7 @@ thread_main_connection_upgrade (struct MHD_Connection *con) struct MHD_Daemon *daemon = con->daemon; mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (con->pid) ); + MHD_thread_ID_is_current_thread_ (con->pid) ); /* Here, we need to bi-directionally forward until the application tells us that it is done with the socket; */ @@ -2743,7 +2743,7 @@ new_connection_process_ (struct MHD_Daemon *daemon, /* Function manipulate connection and timeout DL-lists, * must be called only within daemon thread. */ mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); mhd_assert (NULL == daemon->worker_pool); #endif /* MHD_USE_THREADS */ @@ -3102,7 +3102,7 @@ internal_suspend_connection_ (struct MHD_Connection *connection) #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); #endif if (connection->resuming) @@ -3199,7 +3199,7 @@ MHD_suspend_connection (struct MHD_Connection *connection) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); #endif /* MHD_USE_THREADS */ if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) @@ -3323,7 +3323,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon) #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) mhd_assert (NULL == daemon->worker_pool); mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); #endif ret = MHD_NO; @@ -3664,7 +3664,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); mhd_assert (NULL == daemon->worker_pool); #endif /* MHD_USE_THREADS */ @@ -3888,7 +3888,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) struct MHD_Connection *pos; #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); mhd_assert (NULL == daemon->worker_pool); MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); @@ -4075,7 +4075,7 @@ MHD_get_timeout64 (struct MHD_Daemon *daemon, #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); #endif /* MHD_USE_THREADS */ if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) @@ -5070,7 +5070,7 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); #endif /* MHD_USE_THREADS */ num_events = MAX_EVENTS; @@ -5611,7 +5611,7 @@ close_connection (struct MHD_Connection *pos) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); mhd_assert (NULL == daemon->worker_pool); #endif /* MHD_USE_THREADS */ @@ -8175,7 +8175,7 @@ close_all_connections (struct MHD_Daemon *daemon) #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); + MHD_thread_ID_is_current_thread_ (daemon->pid) ); mhd_assert (NULL == daemon->worker_pool); #endif /* MHD_USE_THREADS */ mhd_assert (daemon->shutdown); diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h @@ -157,19 +157,20 @@ typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_; #if defined(MHD_USE_POSIX_THREADS) /** - * Check whether provided thread ID match current thread. + * Check whether provided thread ID matches current thread. * @param ID thread ID to match * @return nonzero on match, zero otherwise */ -#define MHD_thread_ID_match_current_(pid) \ - (pthread_equal ((pid).ID, pthread_self ())) +# define MHD_thread_ID_is_current_thread_(pid) \ + (pthread_equal ((pid).ID, pthread_self ())) #elif defined(MHD_USE_W32_THREADS) /** - * Check whether provided thread ID match current thread. + * Check whether provided thread ID matches current thread. * @param ID thread ID to match * @return nonzero on match, zero otherwise */ -#define MHD_thread_ID_match_current_(pid) (GetCurrentThreadId () == (pid).ID) +# define MHD_thread_ID_is_current_thread_(pid) \ + (GetCurrentThreadId () == (pid).ID) #endif #if defined(MHD_USE_POSIX_THREADS) diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c @@ -1939,7 +1939,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response, #ifdef MHD_USE_THREADS mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (connection->pid) ); + MHD_thread_ID_is_current_thread_ (connection->pid) ); #endif /* MHD_USE_THREADS */ /* "Upgrade" responses accepted only if MHD_ALLOW_UPGRADE is enabled */