Annotation of embedaddon/curl/docs/libcurl/curl_multi_wakeup.3, revision 1.1.1.1
1.1 misho 1: .\" **************************************************************************
2: .\" * _ _ ____ _
3: .\" * Project ___| | | | _ \| |
4: .\" * / __| | | | |_) | |
5: .\" * | (__| |_| | _ <| |___
6: .\" * \___|\___/|_| \_\_____|
7: .\" *
8: .\" * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
9: .\" *
10: .\" * This software is licensed as described in the file COPYING, which
11: .\" * you should have received as part of this distribution. The terms
12: .\" * are also available at https://curl.haxx.se/docs/copyright.html.
13: .\" *
14: .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15: .\" * copies of the Software, and permit persons to whom the Software is
16: .\" * furnished to do so, under the terms of the COPYING file.
17: .\" *
18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19: .\" * KIND, either express or implied.
20: .\" *
21: .\" **************************************************************************
22: .TH curl_multi_wakeup 3 "November 25, 2019" "libcurl 7.70.0" "libcurl Manual"
23:
24: .SH NAME
25: curl_multi_wakeup - wakes up a sleeping curl_multi_poll call
26: .SH SYNOPSIS
27: #include <curl/curl.h>
28:
29: CURLMcode curl_multi_wakeup(CURLM *multi_handle);
30: .ad
31: .SH DESCRIPTION
32: This function can be called from any thread and it wakes up a
33: sleeping \fIcurl_multi_poll(3)\fP call that is currently (or will be)
34: waiting for activity or a timeout.
35:
36: If the function is called when there is no \fIcurl_multi_poll(3)\fP call,
37: it will cause the next call to return immediately.
38:
39: Calling this function only guarantees to wake up the current (or the next
40: if there is no current) \fIcurl_multi_poll(3)\fP call, which means it is
41: possible that multiple calls to this function will wake up the same waiting
42: operation.
43:
44: This function has no effect on \fIcurl_multi_wait(3)\fP calls.
45: .SH RETURN VALUE
46: CURLMcode type, general libcurl multi interface error code.
47: .SH AVAILABILITY
48: Added in 7.68.0
49: .SH EXAMPLE
50: .nf
51: CURL *easy_handle;
52: CURLM *multi_handle;
53:
54: /* add the individual easy handle */
55: curl_multi_add_handle(multi_handle, easy_handle);
56:
57: /* this is thread 1 */
58: do {
59: CURLMcode mc;
60: int numfds;
61:
62: mc = curl_multi_perform(multi_handle, &still_running);
63:
64: if(mc == CURLM_OK) {
65: /* wait for activity, timeout or wakeup */
66: mc = curl_multi_poll(multi_handle, NULL, 0, 10000, &numfds);
67: }
68:
69: if(time_to_die())
70: exit(1);
71:
72: } while(still_running);
73:
74: curl_multi_remove_handle(multi_handle, easy_handle);
75:
76: /* this is thread 2 */
77:
78: if(something makes us decide to stop thread 1) {
79:
80: set_something_to_signal_thread_1_to_exit();
81:
82: curl_multi_wakeup(multi_handle);
83: }
84:
85: .fi
86: .SH "SEE ALSO"
87: .BR curl_multi_poll "(3), " curl_multi_wait "(3)"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>