aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-10-20 12:45:21 +0200
committerChristian Grothoff <christian@grothoff.org>2018-10-20 12:45:21 +0200
commit4728124102d38067bd2e497b216b12aaee6dea53 (patch)
treedb59cab09b2954fa3d083acd1e78238db6ff311d /src
parentb55cd46bfd8c477cd9eb5c3b6405acea320b5190 (diff)
downloadlibmicrohttpd-4728124102d38067bd2e497b216b12aaee6dea53.tar.gz
libmicrohttpd-4728124102d38067bd2e497b216b12aaee6dea53.zip
notify main thread about thread termination for instant clean up
Diffstat (limited to 'src')
-rw-r--r--src/microhttpd/daemon.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 4999da50..0480af95 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2097,6 +2097,14 @@ exit:
2097 * To avoid data races, do not close socket here. Daemon will 2097 * To avoid data races, do not close socket here. Daemon will
2098 * use more connections only after cleanup anyway. */ 2098 * use more connections only after cleanup anyway. */
2099 } 2099 }
2100 if ( (MHD_ITC_IS_VALID_(daemon->itc)) &&
2101 (! MHD_itc_activate_ (daemon->itc, "t")) )
2102 {
2103#ifdef HAVE_MESSAGES
2104 MHD_DLOG (daemon,
2105 _("Failed to signal thread termination via inter-thread communication channel."));
2106#endif
2107 }
2100 return (MHD_THRD_RTRN_TYPE_) 0; 2108 return (MHD_THRD_RTRN_TYPE_) 0;
2101} 2109}
2102 2110
@@ -4502,8 +4510,8 @@ static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_
4502MHD_polling_thread (void *cls) 4510MHD_polling_thread (void *cls)
4503{ 4511{
4504 struct MHD_Daemon *daemon = cls; 4512 struct MHD_Daemon *daemon = cls;
4505 MHD_thread_init_(&(daemon->pid));
4506 4513
4514 MHD_thread_init_(&(daemon->pid));
4507 while (! daemon->shutdown) 4515 while (! daemon->shutdown)
4508 { 4516 {
4509 if (0 != (daemon->options & MHD_USE_POLL)) 4517 if (0 != (daemon->options & MHD_USE_POLL))