diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-18 21:25:56 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-18 21:25:56 +0000 |
commit | b79c6bca0d047d717378290e675fa9f45d4694e6 (patch) | |
tree | 746b9d8f9332817691f1e1859881b33bacf476d1 | |
parent | 49e615382417d830300fccb051345d9140a6315d (diff) | |
download | libmicrohttpd-b79c6bca0d047d717378290e675fa9f45d4694e6.tar.gz libmicrohttpd-b79c6bca0d047d717378290e675fa9f45d4694e6.zip |
Added more comments about data races.
-rw-r--r-- | src/microhttpd/daemon.c | 8 |
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) | |||
1824 | if (MHD_NO != daemon->resuming) | 1824 | if (MHD_NO != daemon->resuming) |
1825 | next = daemon->suspended_connections_head; | 1825 | next = daemon->suspended_connections_head; |
1826 | 1826 | ||
1827 | /* Clear the flag *only* if connections will be resumed otherwise | ||
1828 | it may accidentally clear flag that was set at the same time in | ||
1829 | other thread (just after 'if (MHD_NO != daemon->resuming)' in | ||
1830 | this thread). | ||
1831 | Clear flag *before* resuming connections otherwise new connection can | ||
1832 | be set to "resuming" in other thread, but missed resuming in this | ||
1833 | function at this time so clearing flag at end will clear it without | ||
1834 | actually resuming of new connection. */ | ||
1827 | if (NULL != next) | 1835 | if (NULL != next) |
1828 | daemon->resuming = MHD_NO; | 1836 | daemon->resuming = MHD_NO; |
1829 | while (NULL != (pos = next)) | 1837 | while (NULL != (pos = next)) |