aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-04-14 16:25:42 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-04-14 19:44:40 +0300
commit726b9c4731948a5e995f197ee3bfacd210c01804 (patch)
tree300e39eed9361b4368242c7fe162751b9c46533b
parent9ce7aa953ad32e25b63b2cce669baf7fdb9da133 (diff)
downloadlibmicrohttpd-726b9c4731948a5e995f197ee3bfacd210c01804.tar.gz
libmicrohttpd-726b9c4731948a5e995f197ee3bfacd210c01804.zip
test_upgrade_large: fixed data race
-rw-r--r--src/microhttpd/test_upgrade_large.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c
index 9f1dbaaa..7de8de2d 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -1085,8 +1085,6 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
1085 MHD_UNSIGNED_LONG_LONG to; 1085 MHD_UNSIGNED_LONG_LONG to;
1086 struct timeval tv; 1086 struct timeval tv;
1087 1087
1088 if (! MHD_itc_init_ (kicker))
1089 abort ();
1090 while (! done) 1088 while (! done)
1091 { 1089 {
1092 FD_ZERO (&rs); 1090 FD_ZERO (&rs);
@@ -1122,8 +1120,6 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
1122 &ws, 1120 &ws,
1123 &es); 1121 &es);
1124 } 1122 }
1125 (void) MHD_itc_destroy_ (kicker);
1126 MHD_itc_set_invalid_ (kicker);
1127} 1123}
1128 1124
1129 1125
@@ -1164,8 +1160,6 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
1164 di = MHD_get_daemon_info (daemon, 1160 di = MHD_get_daemon_info (daemon,
1165 MHD_DAEMON_INFO_EPOLL_FD); 1161 MHD_DAEMON_INFO_EPOLL_FD);
1166 ep = di->listen_fd; 1162 ep = di->listen_fd;
1167 if (! MHD_itc_init_ (kicker))
1168 abort ();
1169 while (! done) 1163 while (! done)
1170 { 1164 {
1171 FD_ZERO (&rs); 1165 FD_ZERO (&rs);
@@ -1191,8 +1185,6 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
1191 MHD_itc_clear_ (kicker); 1185 MHD_itc_clear_ (kicker);
1192 MHD_run (daemon); 1186 MHD_run (daemon);
1193 } 1187 }
1194 (void) MHD_itc_destroy_ (kicker);
1195 MHD_itc_set_invalid_ (kicker);
1196} 1188}
1197 1189
1198 1190
@@ -1329,6 +1321,12 @@ test_upgrade (int flags,
1329#endif /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */ 1321#endif /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */
1330 } 1322 }
1331 1323
1324 if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
1325 {
1326 if (! MHD_itc_init_ (kicker))
1327 abort ();
1328 }
1329
1332 if (0 != pthread_create (&pt_client, 1330 if (0 != pthread_create (&pt_client,
1333 NULL, 1331 NULL,
1334 &run_usock_client, 1332 &run_usock_client,
@@ -1352,6 +1350,11 @@ test_upgrade (int flags,
1352 if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool)) 1350 if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool))
1353 waitpid (pid, NULL, 0); 1351 waitpid (pid, NULL, 0);
1354#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ 1352#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
1353 if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
1354 {
1355 (void) MHD_itc_destroy_ (kicker);
1356 MHD_itc_set_invalid_ (kicker);
1357 }
1355 MHD_stop_daemon (d); 1358 MHD_stop_daemon (d);
1356 return 0; 1359 return 0;
1357} 1360}