summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-18 21:25:56 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-18 21:25:56 +0000
commitb79c6bca0d047d717378290e675fa9f45d4694e6 (patch)
tree746b9d8f9332817691f1e1859881b33bacf476d1
parent49e615382417d830300fccb051345d9140a6315d (diff)
Added more comments about data races.
-rw-r--r--src/microhttpd/daemon.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5af6bd60..2173378d 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1824,6 +1824,14 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
if (MHD_NO != daemon->resuming)
next = daemon->suspended_connections_head;
+ /* Clear the flag *only* if connections will be resumed otherwise
+ it may accidentally clear flag that was set at the same time in
+ other thread (just after 'if (MHD_NO != daemon->resuming)' in
+ this thread).
+ Clear flag *before* resuming connections otherwise new connection can
+ be set to "resuming" in other thread, but missed resuming in this
+ function at this time so clearing flag at end will clear it without
+ actually resuming of new connection. */
if (NULL != next)
daemon->resuming = MHD_NO;
while (NULL != (pos = next))