diff options
Diffstat (limited to 'src/testcurl/perf_get_concurrent.c')
-rw-r--r-- | src/testcurl/perf_get_concurrent.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c index d44f6574..2b519caa 100644 --- a/src/testcurl/perf_get_concurrent.c +++ b/src/testcurl/perf_get_concurrent.c | |||
@@ -75,6 +75,11 @@ static struct MHD_Response *response; | |||
75 | */ | 75 | */ |
76 | static unsigned long long start_time; | 76 | static unsigned long long start_time; |
77 | 77 | ||
78 | /** | ||
79 | * Set to 1 if the worker threads are done. | ||
80 | */ | ||
81 | static volatile int signal_done; | ||
82 | |||
78 | 83 | ||
79 | /** | 84 | /** |
80 | * Get the current timestamp | 85 | * Get the current timestamp |
@@ -132,6 +137,7 @@ copyBuffer (void *ptr, | |||
132 | return size * nmemb; | 137 | return size * nmemb; |
133 | } | 138 | } |
134 | 139 | ||
140 | |||
135 | static int | 141 | static int |
136 | ahc_echo (void *cls, | 142 | ahc_echo (void *cls, |
137 | struct MHD_Connection *connection, | 143 | struct MHD_Connection *connection, |
@@ -159,6 +165,7 @@ ahc_echo (void *cls, | |||
159 | return ret; | 165 | return ret; |
160 | } | 166 | } |
161 | 167 | ||
168 | |||
162 | static void * | 169 | static void * |
163 | thread_gets (void *param) | 170 | thread_gets (void *param) |
164 | { | 171 | { |
@@ -198,6 +205,7 @@ thread_gets (void *param) | |||
198 | return NULL; | 205 | return NULL; |
199 | } | 206 | } |
200 | 207 | ||
208 | |||
201 | static void * | 209 | static void * |
202 | do_gets (void * param) | 210 | do_gets (void * param) |
203 | { | 211 | { |
@@ -225,6 +233,7 @@ do_gets (void * param) | |||
225 | NULL != ret_val) | 233 | NULL != ret_val) |
226 | err = ret_val; | 234 | err = ret_val; |
227 | } | 235 | } |
236 | signal_done = 1; | ||
228 | return err; | 237 | return err; |
229 | } | 238 | } |
230 | 239 | ||
@@ -285,6 +294,7 @@ testMultithreadedGet (int port, int poll_flag) | |||
285 | return 0; | 294 | return 0; |
286 | } | 295 | } |
287 | 296 | ||
297 | |||
288 | static int | 298 | static int |
289 | testMultithreadedPoolGet (int port, int poll_flag) | 299 | testMultithreadedPoolGet (int port, int poll_flag) |
290 | { | 300 | { |
@@ -313,6 +323,7 @@ testMultithreadedPoolGet (int port, int poll_flag) | |||
313 | return 0; | 323 | return 0; |
314 | } | 324 | } |
315 | 325 | ||
326 | |||
316 | static int | 327 | static int |
317 | testExternalGet (int port) | 328 | testExternalGet (int port) |
318 | { | 329 | { |
@@ -332,19 +343,15 @@ testExternalGet (int port) | |||
332 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 343 | port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
333 | if (d == NULL) | 344 | if (d == NULL) |
334 | return 256; | 345 | return 256; |
335 | if (0 != pthread_create(&pid, NULL, &do_gets, (void*)(intptr_t)port)) | 346 | if (0 != pthread_create (&pid, NULL, |
347 | &do_gets, (void*)(intptr_t)port)) | ||
336 | { | 348 | { |
337 | MHD_stop_daemon(d); | 349 | MHD_stop_daemon(d); |
338 | return 512; | 350 | return 512; |
339 | } | 351 | } |
340 | start_timer (); | 352 | start_timer (); |
341 | /* detach so that pthread_kill detection works on Solaris (#4884) */ | 353 | |
342 | if (0 != pthread_detach(pid)) | 354 | while (0 == signal_done) |
343 | { | ||
344 | MHD_stop_daemon(d); | ||
345 | return 512; | ||
346 | } | ||
347 | while (ESRCH != pthread_kill (pid, 0)) | ||
348 | { | 355 | { |
349 | max = 0; | 356 | max = 0; |
350 | FD_ZERO (&rs); | 357 | FD_ZERO (&rs); |