1curl_multi_wakeup(3)            libcurl Manual            curl_multi_wakeup(3)
2
3
4

NAME

6       curl_multi_wakeup - wakes up a sleeping curl_multi_poll call
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLMcode curl_multi_wakeup(CURLM *multi_handle);
12

DESCRIPTION

14       This  function can be called from any thread and it wakes up a sleeping
15       curl_multi_poll(3) call that is currently (or will be) waiting for  ac‐
16       tivity or a timeout.
17
18       If  the function is called when there is no curl_multi_poll(3) call, it
19       will cause the next call to return immediately.
20
21       Calling this function only guarantees to wake up the  current  (or  the
22       next if there is no current) curl_multi_poll(3) call, which means it is
23       possible that multiple calls to this function will  wake  up  the  same
24       waiting operation.
25
26       This function has no effect on curl_multi_wait(3) calls.
27

EXAMPLE

29       CURL *easy_handle;
30       CURLM *multi_handle;
31
32       /* add the individual easy handle */
33       curl_multi_add_handle(multi_handle, easy_handle);
34
35       /* this is thread 1 */
36       do {
37         CURLMcode mc;
38         int numfds;
39
40         mc = curl_multi_perform(multi_handle, &still_running);
41
42         if(mc == CURLM_OK) {
43           /* wait for activity, timeout or wakeup */
44           mc = curl_multi_poll(multi_handle, NULL, 0, 10000, &numfds);
45         }
46
47         if(time_to_die())
48           exit(1);
49
50       } while(still_running);
51
52       curl_multi_remove_handle(multi_handle, easy_handle);
53
54       /* this is thread 2 */
55
56       if(something makes us decide to stop thread 1) {
57
58         set_something_to_signal_thread_1_to_exit();
59
60         curl_multi_wakeup(multi_handle);
61       }
62
63

AVAILABILITY

65       Added in 7.68.0
66

RETURN VALUE

68       CURLMcode type, general libcurl multi interface error code.
69

SEE ALSO

71       curl_multi_poll(3), curl_multi_wait(3)
72
73
74
75libcurl 7.85.0                   May 17, 2022             curl_multi_wakeup(3)
Impressum