libmicrohttpd

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

commit 4728124102d38067bd2e497b216b12aaee6dea53
parent b55cd46bfd8c477cd9eb5c3b6405acea320b5190
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 20 Oct 2018 12:45:21 +0200

notify main thread about thread termination for instant clean up

Diffstat:
MChangeLog | 5+++++
Msrc/microhttpd/daemon.c | 10+++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 20 12:44:16 CEST 2018 + In thread-per-connection mode, signal main thread for + thread termination for instant clean-up and application + notification about closed connections. -CG + Tue Oct 16 20:43:41 CEST 2018 Add MHD_RF_HTTP_VERSION_1_0_RESPONSE option to make MHD act more like an HTTP/1.0 server. -GH diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -2097,6 +2097,14 @@ exit: * To avoid data races, do not close socket here. Daemon will * use more connections only after cleanup anyway. */ } + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "t")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal thread termination via inter-thread communication channel.")); +#endif + } return (MHD_THRD_RTRN_TYPE_) 0; } @@ -4502,8 +4510,8 @@ static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ MHD_polling_thread (void *cls) { struct MHD_Daemon *daemon = cls; - MHD_thread_init_(&(daemon->pid)); + MHD_thread_init_(&(daemon->pid)); while (! daemon->shutdown) { if (0 != (daemon->options & MHD_USE_POLL))