diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-14 18:46:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-14 18:46:11 +0100 |
commit | ae43b469e0aa72c14788f8864d24d12d1bbe27a6 (patch) | |
tree | fcbebe2f59811fe0064bee2f80113f781cba7abd | |
parent | 8145670329c735a028146e6d5232b34a10adc256 (diff) | |
download | libmicrohttpd-ae43b469e0aa72c14788f8864d24d12d1bbe27a6.tar.gz libmicrohttpd-ae43b469e0aa72c14788f8864d24d12d1bbe27a6.zip |
fix use of 'signal_done' in test
-rw-r--r-- | src/testcurl/perf_get_concurrent.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c index 2b519caa..888e77eb 100644 --- a/src/testcurl/perf_get_concurrent.c +++ b/src/testcurl/perf_get_concurrent.c | |||
@@ -28,7 +28,7 @@ | |||
28 | * so the performance scores calculated with this code | 28 | * so the performance scores calculated with this code |
29 | * should NOT be used to compare with other HTTP servers | 29 | * should NOT be used to compare with other HTTP servers |
30 | * (since MHD is actually better); only the relative | 30 | * (since MHD is actually better); only the relative |
31 | * scores between MHD versions are meaningful. | 31 | * scores between MHD versions are meaningful. |
32 | * @author Christian Grothoff | 32 | * @author Christian Grothoff |
33 | */ | 33 | */ |
34 | 34 | ||
@@ -82,11 +82,11 @@ static volatile int signal_done; | |||
82 | 82 | ||
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Get the current timestamp | 85 | * Get the current timestamp |
86 | * | 86 | * |
87 | * @return current time in ms | 87 | * @return current time in ms |
88 | */ | 88 | */ |
89 | static unsigned long long | 89 | static unsigned long long |
90 | now () | 90 | now () |
91 | { | 91 | { |
92 | struct timeval tv; | 92 | struct timeval tv; |
@@ -100,7 +100,7 @@ now () | |||
100 | /** | 100 | /** |
101 | * Start the timer. | 101 | * Start the timer. |
102 | */ | 102 | */ |
103 | static void | 103 | static void |
104 | start_timer() | 104 | start_timer() |
105 | { | 105 | { |
106 | start_time = now (); | 106 | start_time = now (); |
@@ -112,7 +112,7 @@ start_timer() | |||
112 | * | 112 | * |
113 | * @param desc description of the threading mode we used | 113 | * @param desc description of the threading mode we used |
114 | */ | 114 | */ |
115 | static void | 115 | static void |
116 | stop (const char *desc) | 116 | stop (const char *desc) |
117 | { | 117 | { |
118 | double rps = ((double) (PAR * ROUNDS * 1000)) / ((double) (now() - start_time)); | 118 | double rps = ((double) (PAR * ROUNDS * 1000)) / ((double) (now() - start_time)); |
@@ -130,8 +130,8 @@ stop (const char *desc) | |||
130 | 130 | ||
131 | 131 | ||
132 | static size_t | 132 | static size_t |
133 | copyBuffer (void *ptr, | 133 | copyBuffer (void *ptr, |
134 | size_t size, size_t nmemb, | 134 | size_t size, size_t nmemb, |
135 | void *ctx) | 135 | void *ctx) |
136 | { | 136 | { |
137 | return size * nmemb; | 137 | return size * nmemb; |
@@ -247,6 +247,7 @@ testInternalGet (int port, int poll_flag) | |||
247 | (poll_flag & MHD_USE_EPOLL) ? "internal thread with epoll" : "internal thread with select()"); | 247 | (poll_flag & MHD_USE_EPOLL) ? "internal thread with epoll" : "internal thread with select()"); |
248 | const char * ret_val; | 248 | const char * ret_val; |
249 | 249 | ||
250 | signal_done = 0; | ||
250 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, | 251 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, |
251 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 252 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
252 | if (d == NULL) | 253 | if (d == NULL) |
@@ -276,6 +277,7 @@ testMultithreadedGet (int port, int poll_flag) | |||
276 | : "internal thread with select() and thread per connection"); | 277 | : "internal thread with select() and thread per connection"); |
277 | const char * ret_val; | 278 | const char * ret_val; |
278 | 279 | ||
280 | signal_done = 0; | ||
279 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, | 281 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, |
280 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 282 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
281 | if (d == NULL) | 283 | if (d == NULL) |
@@ -304,6 +306,7 @@ testMultithreadedPoolGet (int port, int poll_flag) | |||
304 | (poll_flag & MHD_USE_EPOLL) ? "internal thread poll with epoll" : "internal thread pool with select()"); | 306 | (poll_flag & MHD_USE_EPOLL) ? "internal thread poll with epoll" : "internal thread pool with select()"); |
305 | const char * ret_val; | 307 | const char * ret_val; |
306 | 308 | ||
309 | signal_done = 0 ; | ||
307 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, | 310 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, |
308 | port, NULL, NULL, &ahc_echo, "GET", | 311 | port, NULL, NULL, &ahc_echo, "GET", |
309 | MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); | 312 | MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); |
@@ -339,6 +342,7 @@ testExternalGet (int port) | |||
339 | char *ret_val; | 342 | char *ret_val; |
340 | int ret = 0; | 343 | int ret = 0; |
341 | 344 | ||
345 | signal_done = 0; | ||
342 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, | 346 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, |
343 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 347 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
344 | if (d == NULL) | 348 | if (d == NULL) |
@@ -374,7 +378,7 @@ testExternalGet (int port) | |||
374 | "select failed: %s\n", | 378 | "select failed: %s\n", |
375 | strerror (errno)); | 379 | strerror (errno)); |
376 | ret |= 1024; | 380 | ret |= 1024; |
377 | break; | 381 | break; |
378 | } | 382 | } |
379 | MHD_run_from_select(d, &rs, &ws, &es); | 383 | MHD_run_from_select(d, &rs, &ws, &es); |
380 | } | 384 | } |