Skip to content
Snippets Groups Projects
Commit 4c070de4 authored by Dave Reisner's avatar Dave Reisner Committed by Daniel Stenberg
Browse files

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.
parent 54faab69
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,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 */
......@@ -118,7 +118,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
}
} while(still_running);
/* See how the transfers went */
while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
......
......@@ -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);
......
......@@ -59,7 +59,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 */
......@@ -108,7 +108,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
}
} while(still_running);
curl_multi_cleanup(multi_handle);
......
......@@ -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);
......
......@@ -55,7 +55,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 */
......@@ -106,7 +106,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
}
} while(still_running);
curl_multi_cleanup(multi_handle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment