commit 366a260595db768fa12371b8a746894e73f5af79
parent 11dc6d06afa0fe8f7d2eb8a64d9a7698a3192434
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Fri, 22 Apr 2016 15:03:27 +0000
Fixed race conditions for thread pool.
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Apr 22 14:29:28 CET 2016
+ Fixed race conditions when stopping quiesced daemon with thread
+ pool. -EG
+
Wed Apr 20 18:12:30 CET 2016
Fixed macros in sysfdsetsize.c which could prevent compiling with
non-default FD_SETSIZE.
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -4306,7 +4306,8 @@ MHD_start_daemon_va (unsigned int flags,
d->worker_pool_size = 0;
d->worker_pool = NULL;
- if (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME))
+ /* Always use individual control pipes */
+ if (1)
{
if (0 != MHD_pipe_ (d->wpipe))
{
@@ -4330,7 +4331,6 @@ MHD_start_daemon_va (unsigned int flags,
}
#ifndef MHD_WINSOCK_SOCKETS
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) &&
- (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) &&
(d->wpipe[0] >= FD_SETSIZE) )
{
#ifdef HAVE_MESSAGES
@@ -4650,7 +4650,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
(0 != MHD_socket_close_ (daemon->worker_pool[i].epoll_fd)) )
MHD_PANIC ("close failed\n");
#endif
- if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) )
+ /* Individual pipes are always used */
+ if (1)
{
if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1])
{