aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/multi-debugcallback.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-07-23 15:34:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2012-08-27 15:10:13 +0200
commit4c070de4fb01b4fbf29f8c463ba96da97b36bd2f (patch)
tree3be5aa0d1ff12fa758b8d0ddd88ba35095b4f668 /docs/examples/multi-debugcallback.c
parent54faab69cbdabe51bab1bdee0a9c69e423178084 (diff)
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.
Diffstat (limited to 'docs/examples/multi-debugcallback.c')
-rw-r--r--docs/examples/multi-debugcallback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c
index c7e819d03..8eedcee5b 100644
--- a/docs/examples/multi-debugcallback.c
+++ b/docs/examples/multi-debugcallback.c
@@ -144,7 +144,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
- while(still_running) {
+ do {
struct timeval timeout;
int rc; /* select() return code */
@@ -195,7 +195,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
- }
+ } while(still_running);
curl_multi_cleanup(multi_handle);