aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd')
-rw-r--r--src/microhttpd/connection.c10
-rw-r--r--src/microhttpd/daemon.c44
-rw-r--r--src/microhttpd/internal.h4
-rw-r--r--src/microhttpd/mhd_threads.h8
-rw-r--r--src/microhttpd/response.c2
5 files changed, 34 insertions, 34 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c6682927..50a5de32 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1151,7 +1151,7 @@ MHD_connection_close_ (struct MHD_Connection *connection,
1151 mhd_assert (! connection->suspended); 1151 mhd_assert (! connection->suspended);
1152#ifdef MHD_USE_THREADS 1152#ifdef MHD_USE_THREADS
1153 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 1153 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
1154 MHD_thread_ID_is_current_thread_ (connection->pid) ); 1154 MHD_thread_ID_is_current_thread_ (connection->tid) );
1155#endif /* MHD_USE_THREADS */ 1155#endif /* MHD_USE_THREADS */
1156 if ( (NULL != daemon->notify_completed) && 1156 if ( (NULL != daemon->notify_completed) &&
1157 (connection->rq.client_aware) ) 1157 (connection->rq.client_aware) )
@@ -1195,7 +1195,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
1195#ifdef MHD_USE_THREADS 1195#ifdef MHD_USE_THREADS
1196 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 1196 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
1197 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ 1197 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \
1198 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 1198 MHD_thread_ID_is_current_thread_ (daemon->tid) );
1199#endif /* MHD_USE_THREADS */ 1199#endif /* MHD_USE_THREADS */
1200 1200
1201 if (0 == (daemon->options & MHD_USE_TLS)) 1201 if (0 == (daemon->options & MHD_USE_TLS))
@@ -6248,7 +6248,7 @@ cleanup_connection (struct MHD_Connection *connection)
6248 struct MHD_Daemon *daemon = connection->daemon; 6248 struct MHD_Daemon *daemon = connection->daemon;
6249#ifdef MHD_USE_THREADS 6249#ifdef MHD_USE_THREADS
6250 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 6250 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
6251 MHD_thread_ID_is_current_thread_ (connection->pid) ); 6251 MHD_thread_ID_is_current_thread_ (connection->tid) );
6252 mhd_assert (NULL == daemon->worker_pool); 6252 mhd_assert (NULL == daemon->worker_pool);
6253#endif /* MHD_USE_THREADS */ 6253#endif /* MHD_USE_THREADS */
6254 6254
@@ -6455,7 +6455,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
6455 enum MHD_Result ret; 6455 enum MHD_Result ret;
6456#ifdef MHD_USE_THREADS 6456#ifdef MHD_USE_THREADS
6457 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 6457 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
6458 MHD_thread_ID_is_current_thread_ (connection->pid) ); 6458 MHD_thread_ID_is_current_thread_ (connection->tid) );
6459#endif /* MHD_USE_THREADS */ 6459#endif /* MHD_USE_THREADS */
6460 /* 'daemon' is not used if epoll is not available and asserts are disabled */ 6460 /* 'daemon' is not used if epoll is not available and asserts are disabled */
6461 (void) daemon; /* Mute compiler warning */ 6461 (void) daemon; /* Mute compiler warning */
@@ -7139,7 +7139,7 @@ MHD_queue_response (struct MHD_Connection *connection,
7139#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 7139#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
7140 if ( (! connection->suspended) && 7140 if ( (! connection->suspended) &&
7141 (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && 7141 (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) &&
7142 (! MHD_thread_ID_is_current_thread_ (connection->pid)) ) 7142 (! MHD_thread_ID_is_current_thread_ (connection->tid)) )
7143 { 7143 {
7144#ifdef HAVE_MESSAGES 7144#ifdef HAVE_MESSAGES
7145 MHD_DLOG (daemon, 7145 MHD_DLOG (daemon,
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 9c1315e7..36c67074 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1322,7 +1322,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1322 1322
1323#ifdef MHD_USE_THREADS 1323#ifdef MHD_USE_THREADS
1324 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 1324 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
1325 MHD_thread_ID_is_current_thread_ (connection->pid) ); 1325 MHD_thread_ID_is_current_thread_ (connection->tid) );
1326#endif /* MHD_USE_THREADS */ 1326#endif /* MHD_USE_THREADS */
1327 if (daemon->shutdown) 1327 if (daemon->shutdown)
1328 { 1328 {
@@ -1670,7 +1670,7 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
1670 struct MHD_Daemon *daemon = con->daemon; 1670 struct MHD_Daemon *daemon = con->daemon;
1671 1671
1672 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 1672 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
1673 MHD_thread_ID_is_current_thread_ (con->pid) ); 1673 MHD_thread_ID_is_current_thread_ (con->tid) );
1674 /* Here, we need to bi-directionally forward 1674 /* Here, we need to bi-directionally forward
1675 until the application tells us that it is done 1675 until the application tells us that it is done
1676 with the socket; */ 1676 with the socket; */
@@ -1896,7 +1896,7 @@ thread_main_handle_connection (void *data)
1896 const bool use_poll = 0; 1896 const bool use_poll = 0;
1897#endif /* ! HAVE_POLL */ 1897#endif /* ! HAVE_POLL */
1898 bool was_suspended = false; 1898 bool was_suspended = false;
1899 MHD_thread_init_ (&(con->pid)); 1899 MHD_thread_init_ (&(con->tid));
1900 1900
1901 while ( (! daemon->shutdown) && 1901 while ( (! daemon->shutdown) &&
1902 (MHD_CONNECTION_CLOSED != con->state) ) 1902 (MHD_CONNECTION_CLOSED != con->state) )
@@ -2743,7 +2743,7 @@ new_connection_process_ (struct MHD_Daemon *daemon,
2743 /* Function manipulate connection and timeout DL-lists, 2743 /* Function manipulate connection and timeout DL-lists,
2744 * must be called only within daemon thread. */ 2744 * must be called only within daemon thread. */
2745 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 2745 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
2746 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 2746 MHD_thread_ID_is_current_thread_ (daemon->tid) );
2747 mhd_assert (NULL == daemon->worker_pool); 2747 mhd_assert (NULL == daemon->worker_pool);
2748#endif /* MHD_USE_THREADS */ 2748#endif /* MHD_USE_THREADS */
2749 2749
@@ -2806,7 +2806,7 @@ new_connection_process_ (struct MHD_Daemon *daemon,
2806 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 2806 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
2807 { 2807 {
2808 mhd_assert (0 == (daemon->options & MHD_USE_EPOLL)); 2808 mhd_assert (0 == (daemon->options & MHD_USE_EPOLL));
2809 if (! MHD_create_named_thread_ (&connection->pid, 2809 if (! MHD_create_named_thread_ (&connection->tid,
2810 "MHD-connection", 2810 "MHD-connection",
2811 daemon->thread_stack_size, 2811 daemon->thread_stack_size,
2812 &thread_main_handle_connection, 2812 &thread_main_handle_connection,
@@ -2836,7 +2836,7 @@ new_connection_process_ (struct MHD_Daemon *daemon,
2836#endif /* ! MHD_USE_THREADS */ 2836#endif /* ! MHD_USE_THREADS */
2837 { /* No 'thread-per-connection' */ 2837 { /* No 'thread-per-connection' */
2838#ifdef MHD_USE_THREADS 2838#ifdef MHD_USE_THREADS
2839 connection->pid = daemon->pid; 2839 connection->tid = daemon->tid;
2840#endif /* MHD_USE_THREADS */ 2840#endif /* MHD_USE_THREADS */
2841#ifdef EPOLL_SUPPORT 2841#ifdef EPOLL_SUPPORT
2842 if (0 != (daemon->options & MHD_USE_EPOLL)) 2842 if (0 != (daemon->options & MHD_USE_EPOLL))
@@ -3102,7 +3102,7 @@ internal_suspend_connection_ (struct MHD_Connection *connection)
3102#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 3102#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
3103 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 3103 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
3104 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ 3104 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \
3105 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 3105 MHD_thread_ID_is_current_thread_ (daemon->tid) );
3106 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 3106 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
3107#endif 3107#endif
3108 if (connection->resuming) 3108 if (connection->resuming)
@@ -3199,7 +3199,7 @@ MHD_suspend_connection (struct MHD_Connection *connection)
3199#ifdef MHD_USE_THREADS 3199#ifdef MHD_USE_THREADS
3200 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 3200 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
3201 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ 3201 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \
3202 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 3202 MHD_thread_ID_is_current_thread_ (daemon->tid) );
3203#endif /* MHD_USE_THREADS */ 3203#endif /* MHD_USE_THREADS */
3204 3204
3205 if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) 3205 if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME))
@@ -3323,7 +3323,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
3323#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 3323#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
3324 mhd_assert (NULL == daemon->worker_pool); 3324 mhd_assert (NULL == daemon->worker_pool);
3325 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 3325 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
3326 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 3326 MHD_thread_ID_is_current_thread_ (daemon->tid) );
3327#endif 3327#endif
3328 3328
3329 ret = MHD_NO; 3329 ret = MHD_NO;
@@ -3664,7 +3664,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
3664 3664
3665#ifdef MHD_USE_THREADS 3665#ifdef MHD_USE_THREADS
3666 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 3666 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
3667 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 3667 MHD_thread_ID_is_current_thread_ (daemon->tid) );
3668 mhd_assert (NULL == daemon->worker_pool); 3668 mhd_assert (NULL == daemon->worker_pool);
3669#endif /* MHD_USE_THREADS */ 3669#endif /* MHD_USE_THREADS */
3670 3670
@@ -3888,7 +3888,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
3888 struct MHD_Connection *pos; 3888 struct MHD_Connection *pos;
3889#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 3889#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
3890 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 3890 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
3891 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 3891 MHD_thread_ID_is_current_thread_ (daemon->tid) );
3892 mhd_assert (NULL == daemon->worker_pool); 3892 mhd_assert (NULL == daemon->worker_pool);
3893 3893
3894 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 3894 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -3902,7 +3902,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
3902 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 3902 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
3903 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && 3903 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
3904 (! pos->thread_joined) && 3904 (! pos->thread_joined) &&
3905 (! MHD_join_thread_ (pos->pid.handle)) ) 3905 (! MHD_join_thread_ (pos->tid.handle)) )
3906 MHD_PANIC (_ ("Failed to join a thread.\n")); 3906 MHD_PANIC (_ ("Failed to join a thread.\n"));
3907#endif 3907#endif
3908#ifdef UPGRADE_SUPPORT 3908#ifdef UPGRADE_SUPPORT
@@ -4075,7 +4075,7 @@ MHD_get_timeout64 (struct MHD_Daemon *daemon,
4075 4075
4076#ifdef MHD_USE_THREADS 4076#ifdef MHD_USE_THREADS
4077 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 4077 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
4078 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 4078 MHD_thread_ID_is_current_thread_ (daemon->tid) );
4079#endif /* MHD_USE_THREADS */ 4079#endif /* MHD_USE_THREADS */
4080 4080
4081 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 4081 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
@@ -5070,7 +5070,7 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
5070 5070
5071#ifdef MHD_USE_THREADS 5071#ifdef MHD_USE_THREADS
5072 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 5072 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
5073 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 5073 MHD_thread_ID_is_current_thread_ (daemon->tid) );
5074#endif /* MHD_USE_THREADS */ 5074#endif /* MHD_USE_THREADS */
5075 5075
5076 num_events = MAX_EVENTS; 5076 num_events = MAX_EVENTS;
@@ -5611,7 +5611,7 @@ close_connection (struct MHD_Connection *pos)
5611 5611
5612#ifdef MHD_USE_THREADS 5612#ifdef MHD_USE_THREADS
5613 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 5613 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
5614 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 5614 MHD_thread_ID_is_current_thread_ (daemon->tid) );
5615 mhd_assert (NULL == daemon->worker_pool); 5615 mhd_assert (NULL == daemon->worker_pool);
5616#endif /* MHD_USE_THREADS */ 5616#endif /* MHD_USE_THREADS */
5617 5617
@@ -5665,7 +5665,7 @@ MHD_polling_thread (void *cls)
5665 int err; 5665 int err;
5666#endif /* HAVE_PTHREAD_SIGMASK */ 5666#endif /* HAVE_PTHREAD_SIGMASK */
5667 5667
5668 MHD_thread_init_ (&(daemon->pid)); 5668 MHD_thread_init_ (&(daemon->tid));
5669#ifdef HAVE_PTHREAD_SIGMASK 5669#ifdef HAVE_PTHREAD_SIGMASK
5670 if ((0 == sigemptyset (&s_mask)) && 5670 if ((0 == sigemptyset (&s_mask)) &&
5671 (0 == sigaddset (&s_mask, SIGPIPE))) 5671 (0 == sigaddset (&s_mask, SIGPIPE)))
@@ -7863,7 +7863,7 @@ MHD_start_daemon_va (unsigned int flags,
7863 MHD_socket_close_chk_ (listen_fd); 7863 MHD_socket_close_chk_ (listen_fd);
7864 goto free_and_fail; 7864 goto free_and_fail;
7865 } 7865 }
7866 if (! MHD_create_named_thread_ (&daemon->pid, 7866 if (! MHD_create_named_thread_ (&daemon->tid,
7867 (*pflags 7867 (*pflags
7868 & MHD_USE_THREAD_PER_CONNECTION) ? 7868 & MHD_USE_THREAD_PER_CONNECTION) ?
7869 "MHD-listen" : "MHD-single", 7869 "MHD-listen" : "MHD-single",
@@ -8012,7 +8012,7 @@ MHD_start_daemon_va (unsigned int flags,
8012#endif /* DAUTH_SUPPORT */ 8012#endif /* DAUTH_SUPPORT */
8013 8013
8014 /* Spawn the worker thread */ 8014 /* Spawn the worker thread */
8015 if (! MHD_create_named_thread_ (&d->pid, 8015 if (! MHD_create_named_thread_ (&d->tid,
8016 "MHD-worker", 8016 "MHD-worker",
8017 daemon->thread_stack_size, 8017 daemon->thread_stack_size,
8018 &MHD_polling_thread, 8018 &MHD_polling_thread,
@@ -8175,7 +8175,7 @@ close_all_connections (struct MHD_Daemon *daemon)
8175#ifdef MHD_USE_THREADS 8175#ifdef MHD_USE_THREADS
8176 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 8176 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
8177 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \ 8177 (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || \
8178 MHD_thread_ID_is_current_thread_ (daemon->pid) ); 8178 MHD_thread_ID_is_current_thread_ (daemon->tid) );
8179 mhd_assert (NULL == daemon->worker_pool); 8179 mhd_assert (NULL == daemon->worker_pool);
8180#endif /* MHD_USE_THREADS */ 8180#endif /* MHD_USE_THREADS */
8181 mhd_assert (daemon->shutdown); 8181 mhd_assert (daemon->shutdown);
@@ -8288,7 +8288,7 @@ close_all_connections (struct MHD_Daemon *daemon)
8288 * MHD_resume_connection() during finishing of "upgraded" 8288 * MHD_resume_connection() during finishing of "upgraded"
8289 * thread. */ 8289 * thread. */
8290 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 8290 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
8291 if (! MHD_join_thread_ (pos->pid.handle)) 8291 if (! MHD_join_thread_ (pos->tid.handle))
8292 MHD_PANIC (_ ("Failed to join a thread.\n")); 8292 MHD_PANIC (_ ("Failed to join a thread.\n"));
8293 pos->thread_joined = true; 8293 pos->thread_joined = true;
8294 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 8294 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -8320,7 +8320,7 @@ close_all_connections (struct MHD_Daemon *daemon)
8320 if (! pos->thread_joined) 8320 if (! pos->thread_joined)
8321 { 8321 {
8322 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 8322 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
8323 if (! MHD_join_thread_ (pos->pid.handle)) 8323 if (! MHD_join_thread_ (pos->tid.handle))
8324 MHD_PANIC (_ ("Failed to join a thread.\n")); 8324 MHD_PANIC (_ ("Failed to join a thread.\n"));
8325 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 8325 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
8326 pos->thread_joined = true; 8326 pos->thread_joined = true;
@@ -8458,7 +8458,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
8458 mhd_assert (false); /* Should never happen */ 8458 mhd_assert (false); /* Should never happen */
8459 } 8459 }
8460 8460
8461 if (! MHD_join_thread_ (daemon->pid.handle)) 8461 if (! MHD_join_thread_ (daemon->tid.handle))
8462 { 8462 {
8463 MHD_PANIC (_ ("Failed to join a thread.\n")); 8463 MHD_PANIC (_ ("Failed to join a thread.\n"));
8464 } 8464 }
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 56657e19..27e9a50f 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1386,7 +1386,7 @@ struct MHD_Connection
1386 * Thread handle for this connection (if we are using 1386 * Thread handle for this connection (if we are using
1387 * one thread per connection). 1387 * one thread per connection).
1388 */ 1388 */
1389 MHD_thread_handle_ID_ pid; 1389 MHD_thread_handle_ID_ tid;
1390#endif 1390#endif
1391 1391
1392 /** 1392 /**
@@ -2121,7 +2121,7 @@ struct MHD_Daemon
2121 /** 2121 /**
2122 * The select thread handle (if we have internal select) 2122 * The select thread handle (if we have internal select)
2123 */ 2123 */
2124 MHD_thread_handle_ID_ pid; 2124 MHD_thread_handle_ID_ tid;
2125 2125
2126 /** 2126 /**
2127 * Mutex for per-IP connection counts. 2127 * Mutex for per-IP connection counts.
diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h
index 4cd60974..925ac95d 100644
--- a/src/microhttpd/mhd_threads.h
+++ b/src/microhttpd/mhd_threads.h
@@ -161,16 +161,16 @@ typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_;
161 * @param ID thread ID to match 161 * @param ID thread ID to match
162 * @return nonzero on match, zero otherwise 162 * @return nonzero on match, zero otherwise
163 */ 163 */
164# define MHD_thread_ID_is_current_thread_(pid) \ 164# define MHD_thread_ID_is_current_thread_(tid) \
165 (pthread_equal ((pid).ID, pthread_self ())) 165 (pthread_equal ((tid).ID, pthread_self ()))
166#elif defined(MHD_USE_W32_THREADS) 166#elif defined(MHD_USE_W32_THREADS)
167/** 167/**
168 * Check whether provided thread ID matches current thread. 168 * Check whether provided thread ID matches current thread.
169 * @param ID thread ID to match 169 * @param ID thread ID to match
170 * @return nonzero on match, zero otherwise 170 * @return nonzero on match, zero otherwise
171 */ 171 */
172# define MHD_thread_ID_is_current_thread_(pid) \ 172# define MHD_thread_ID_is_current_thread_(tid) \
173 (GetCurrentThreadId () == (pid).ID) 173 (GetCurrentThreadId () == (tid).ID)
174#endif 174#endif
175 175
176#if defined(MHD_USE_POSIX_THREADS) 176#if defined(MHD_USE_POSIX_THREADS)
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 12c034ca..3f278689 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -1939,7 +1939,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
1939 1939
1940#ifdef MHD_USE_THREADS 1940#ifdef MHD_USE_THREADS
1941 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ 1941 mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
1942 MHD_thread_ID_is_current_thread_ (connection->pid) ); 1942 MHD_thread_ID_is_current_thread_ (connection->tid) );
1943#endif /* MHD_USE_THREADS */ 1943#endif /* MHD_USE_THREADS */
1944 1944
1945 /* "Upgrade" responses accepted only if MHD_ALLOW_UPGRADE is enabled */ 1945 /* "Upgrade" responses accepted only if MHD_ALLOW_UPGRADE is enabled */