1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

docs/examples: do not wait when no transfers are running

Closes #2948
This commit is contained in:
Kamil Dudka 2018-09-07 16:15:24 +02:00
parent 2099dde2c8
commit 1d173f3413
8 changed files with 24 additions and 24 deletions

View File

@ -189,7 +189,7 @@ int main(int argc, char **argv)
CURL *easy[NUM_HANDLES];
CURLM *multi_handle;
int i;
int still_running; /* keep number of running handles */
int still_running = 0; /* keep number of running handles */
if(argc > 1)
/* if given a number, do that many transfers */
@ -215,7 +215,7 @@ int main(int argc, char **argv)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -284,7 +284,7 @@ int main(int argc, char **argv)
curl_multi_perform(multi_handle, &still_running);
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);

View File

@ -245,7 +245,7 @@ int main(int argc, char **argv)
CURL *easy[NUM_HANDLES];
CURLM *multi_handle;
int i;
int still_running; /* keep number of running handles */
int still_running = 0; /* keep number of running handles */
const char *filename = "index.html";
if(argc > 1)
@ -279,7 +279,7 @@ int main(int argc, char **argv)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -348,7 +348,7 @@ int main(int argc, char **argv)
curl_multi_perform(multi_handle, &still_running);
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);

View File

@ -48,7 +48,7 @@ int main(void)
CURL *handles[HANDLECOUNT];
CURLM *multi_handle;
int still_running; /* keep number of running handles */
int still_running = 0; /* keep number of running handles */
int i;
CURLMsg *msg; /* for picking up messages with the transfer status */
@ -74,7 +74,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -142,7 +142,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))) {

View File

@ -131,7 +131,7 @@ int main(void)
CURL *http_handle;
CURLM *multi_handle;
int still_running; /* keep number of running handles */
int still_running = 0; /* keep number of running handles */
http_handle = curl_easy_init();
@ -150,7 +150,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -221,7 +221,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);

View File

@ -42,7 +42,7 @@ int main(void)
CURL *http_handle2;
CURLM *multi_handle;
int still_running; /* keep number of running handles */
int still_running = 0; /* keep number of running handles */
http_handle = curl_easy_init();
http_handle2 = curl_easy_init();
@ -63,7 +63,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -132,7 +132,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);

View File

@ -35,7 +35,7 @@ int main(void)
CURL *curl;
CURLM *multi_handle;
int still_running;
int still_running = 0;
struct curl_httppost *formpost = NULL;
struct curl_httppost *lastptr = NULL;
@ -83,7 +83,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -154,7 +154,7 @@ int main(void)
printf("running: %d!\n", still_running);
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);

View File

@ -35,7 +35,7 @@ int main(void)
CURL *curl;
CURLM *multi_handle;
int still_running;
int still_running = 0;
curl_mime *form = NULL;
curl_mimepart *field = NULL;
@ -79,7 +79,7 @@ int main(void)
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
struct timeval timeout;
int rc; /* select() return code */
CURLMcode mc; /* curl_multi_fdset() return code */
@ -150,7 +150,7 @@ int main(void)
printf("running: %d!\n", still_running);
break;
}
} while(still_running);
}
curl_multi_cleanup(multi_handle);

View File

@ -51,7 +51,7 @@ int main(void)
CURL *http_handle;
CURLM *multi_handle;
int still_running; /* keep number of running handles */
int still_running = 0; /* keep number of running handles */
int repeats = 0;
curl_global_init(CURL_GLOBAL_DEFAULT);
@ -70,7 +70,7 @@ int main(void)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
do {
while(still_running) {
CURLMcode mc; /* curl_multi_wait() return code */
int numfds;
@ -97,7 +97,7 @@ int main(void)
repeats = 0;
curl_multi_perform(multi_handle, &still_running);
} while(still_running);
}
curl_multi_remove_handle(multi_handle, http_handle);