1libcurl-share(3) libcurl share interface libcurl-share(3)
2
3
4
6 libcurl-share - how to use the share interface
7
9 This is an overview on how to use the libcurl share interface in your C
10 programs. There are specific man pages for each function mentioned in
11 here.
12
13 All functions in the share interface are prefixed with curl_share.
14
15
17 The share interface was added to enable sharing of data between curl
18 "handles".
19
21 You can have multiple easy handles share data between them. Have them
22 update and use the same cookie database or DNS cache! This way, each
23 single transfer will take advantage from data updates made by the other
24 transfer(s).
25
27 You create a shared object with curl_share_init(3). It returns a handle
28 for a newly created one.
29
30 You tell the shared object what data you want it to share by using
31 curl_share_setopt(3). Currently you can only share DNS and/or COOKIE
32 data.
33
34 Since you can use this share from multiple threads, and libcurl has no
35 internal thread synchronization, you must provide mutex callbacks if
36 you're using this multi-threaded. You set lock and unlock functions
37 with curl_share_setopt(3) too.
38
39 Then, you make an easy handle to use this share, you set the CUR‐
40 LOPT_SHARE option with curl_easy_setopt(3), and pass in share handle.
41 You can make any number of easy handles share the same share handle.
42
43 To make an easy handle stop using that particular share, you set CUR‐
44 LOPT_SHARE to NULL for that easy handle. To make a handle stop sharing
45 a particular data, you can CURLSHOPT_UNSHARE it.
46
47 When you're done using the share, make sure that no easy handle is
48 still using it, and call curl_share_cleanup(3) on the handle.
49
51 curl_share_init(3), curl_share_setopt(3), curl_share_cleanup(3)
52
53
54
55libcurl 7.10.7 8 Aug 2003 libcurl-share(3)