1curl_easy_pause(3) libcurl Manual curl_easy_pause(3)
2
3
4
6 curl_easy_pause - pause and unpause a connection
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_pause(CURL *handle, int bitmask );
12
13
15 Using this function, you can explicitly mark a running connection to
16 get paused, and you can unpause a connection that was previously
17 paused.
18
19 A connection can be paused by using this function or by letting the
20 read or the write callbacks return the proper magic return code
21 (CURL_READFUNC_PAUSE and CURL_WRITEFUNC_PAUSE). A write callback that
22 returns pause signals to the library that it couldn't take care of any
23 data at all, and that data will then be delivered again to the callback
24 when the writing is later unpaused.
25
26 NOTE: while it may feel tempting, take care and notice that you cannot
27 call this function from another thread.
28
29 When this function is called to unpause reading, the chance is high
30 that you will get your write callback called before this function
31 returns.
32
33 The handle argument is of course identifying the handle that operates
34 on the connection you want to pause or unpause.
35
36 The bitmask argument is a set of bits that sets the new state of the
37 connection. The following bits can be used:
38
39 CURLPAUSE_RECV
40 Pause receiving data. There will be no data received on this
41 connection until this function is called again without this bit
42 set. Thus, the write callback (CURLOPT_WRITEFUNCTION) won't be
43 called.
44
45 CURLPAUSE_SEND
46 Pause sending data. There will be no data sent on this connec‐
47 tion until this function is called again without this bit set.
48 Thus, the read callback (CURLOPT_READFUNCTION) won't be called.
49
50 CURLPAUSE_ALL
51 Convenience define that pauses both directions.
52
53 CURLPAUSE_CONT
54 Convenience define that unpauses both directions
55
57 CURLE_OK (zero) means that the option was set properly, and a non-zero
58 return code means something wrong occurred after the new state was set.
59 See the libcurl-errors(3) man page for the full list with descriptions.
60
62 This function was added in libcurl 7.18.0. Before this version, there
63 was no explicit support for pausing transfers.
64
66 When pausing a read by returning the magic return code from a write
67 callback, the read data is already in libcurl's internal buffers so
68 it'll have to keep it in an allocated buffer until the reading is again
69 unpaused using this function.
70
71 If the downloaded data is compressed and is asked to get uncompressed
72 automatically on download, libcurl will continue to uncompress the
73 entire downloaded chunk and it will cache the data uncompressed. This
74 has the side- effect that if you download something that is compressed
75 a lot, it can result in a very large data amount needing to be allo‐
76 cated to save the data during the pause. This said, you should probably
77 consider not using paused reading if you allow libcurl to uncompress
78 data automatically.
79
81 curl_easy_cleanup(3), curl_easy_reset(3)
82
83
84
85libcurl 7.18.0 17 Dec 2007 curl_easy_pause(3)