From 4c070de4fb01b4fbf29f8c463ba96da97b36bd2f Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 23 Jul 2012 15:34:25 +0000 Subject: examples: use do/while loop for multi examples It's conceivable that after the first time curl_multi_perform returns, the outvalue still_running will be 0, but work will have been done. This is shown by a workload of small, purely file:// based URLs. Ensure that we always read pending messages off the multi handle by forcing the while loop to run at least once. --- docs/examples/multi-post.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/examples/multi-post.c') diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c index c26338b59..965a2c3f6 100644 --- a/docs/examples/multi-post.c +++ b/docs/examples/multi-post.c @@ -80,7 +80,7 @@ int main(void) curl_multi_perform(multi_handle, &still_running); - while(still_running) { + do { struct timeval timeout; int rc; /* select() return code */ @@ -131,7 +131,7 @@ int main(void) printf("running: %d!\n", still_running); break; } - } + } while(still_running); curl_multi_cleanup(multi_handle); -- cgit v1.2.3