[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/06: mhd_threads: renamed one macro for clarity
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/06: mhd_threads: renamed one macro for clarity |
Date: |
Mon, 11 Sep 2023 18:51:50 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit e55b0418ecae1aea289e8197ef0850690c5fa3f1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Sep 8 11:10:51 2023 +0300
mhd_threads: renamed one macro for clarity
---
src/microhttpd/connection.c | 10 +++++-----
src/microhttpd/daemon.c | 24 ++++++++++++------------
src/microhttpd/mhd_threads.h | 11 ++++++-----
src/microhttpd/response.c | 2 +-
4 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 9440d112..c6682927 100644
--- 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
index 4694afeb..9c1315e7 100644
--- 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
index 0a504635..4cd60974 100644
--- 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
index 277247cc..12c034ca 100644
--- 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 */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (dfbc4da6 -> 97707d77), gnunet, 2023/09/11
- [libmicrohttpd] 01/06: mhd_threads: muted compiler warning on W32, gnunet, 2023/09/11
- [libmicrohttpd] 02/06: mhd_threads: fixed check for error when starting a new thread on W32, gnunet, 2023/09/11
- [libmicrohttpd] 03/06: mhd_threads: renamed one macro for clarity,
gnunet <=
- [libmicrohttpd] 04/06: Renamed 'pid' -> 'tid' when used for threads, gnunet, 2023/09/11
- [libmicrohttpd] 05/06: mhd_threads: added new macro MHD_join_thread_tid_(), gnunet, 2023/09/11
- [libmicrohttpd] 06/06: mhd_str: fixed possible compiler and run-time sanitizers warnings, gnunet, 2023/09/11