aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-12 09:46:22 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-12 09:46:22 +0100
commit648b65aa6c62e040e13976a8a2323829339a1572 (patch)
tree31f7227d23eeb3024e12adedfa07ae934896c4f4
parent2e826fb4ee4dca7fa66f6bb48f2a2bdbe333dce7 (diff)
downloadlibmicrohttpd-648b65aa6c62e040e13976a8a2323829339a1572.tar.gz
libmicrohttpd-648b65aa6c62e040e13976a8a2323829339a1572.zip
better fix for #4884 avoiding the problematic detach and the ERSCH-issue
-rw-r--r--src/testcurl/perf_get_concurrent.c23
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 */
76static unsigned long long start_time; 76static unsigned long long start_time;
77 77
78/**
79 * Set to 1 if the worker threads are done.
80 */
81static 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
135static int 141static int
136ahc_echo (void *cls, 142ahc_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
162static void * 169static void *
163thread_gets (void *param) 170thread_gets (void *param)
164{ 171{
@@ -198,6 +205,7 @@ thread_gets (void *param)
198 return NULL; 205 return NULL;
199} 206}
200 207
208
201static void * 209static void *
202do_gets (void * param) 210do_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
288static int 298static int
289testMultithreadedPoolGet (int port, int poll_flag) 299testMultithreadedPoolGet (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
316static int 327static int
317testExternalGet (int port) 328testExternalGet (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);