libcurl-share.3 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .\" You can view this file with:
  2. .\" nroff -man [file]
  3. .\" $Id$
  4. .\"
  5. .TH libcurl-share 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl share interface"
  6. .SH NAME
  7. libcurl-share \- how to use the share interface
  8. .SH DESCRIPTION
  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. All functions in the share interface are prefixed with curl_share.
  13. .SH "OBJECTIVES"
  14. The share interface was added to enable sharing of data between curl
  15. \&"handles".
  16. .SH "ONE SET OF DATA - MANY TRANSFERS"
  17. You can have multiple easy handles share data between them. Have them update
  18. and use the \fBsame\fP cookie database or DNS cache! This way, each single
  19. transfer will take advantage from data updates made by the other transfer(s).
  20. .SH "SHARE OBJECT"
  21. You create a shared object with \fIcurl_share_init(3)\fP. It returns a handle
  22. for a newly created one.
  23. You tell the shared object what data you want it to share by using
  24. \fIcurl_share_setopt(3)\fP. Currently you can only share DNS and/or COOKIE
  25. data.
  26. Since you can use this share from multiple threads, and libcurl has no
  27. internal thread synchronization, you must provide mutex callbacks if you're
  28. using this multi-threaded. You set lock and unlock functions with
  29. \fIcurl_share_setopt(3)\fP too.
  30. Then, you make an easy handle to use this share, you set the
  31. \fICURLOPT_SHARE\fP option with \fIcurl_easy_setopt(3)\fP, and pass in share
  32. handle. You can make any number of easy handles share the same share handle.
  33. To make an easy handle stop using that particular share, you set
  34. \fICURLOPT_SHARE\fP to NULL for that easy handle. To make a handle stop
  35. sharing a particular data, you can \fICURLSHOPT_UNSHARE\fP it.
  36. When you're done using the share, make sure that no easy handle is still using
  37. it, and call \fIcurl_share_cleanup(3)\fP on the handle.
  38. .SH "SEE ALSO"
  39. .BR curl_share_init "(3), " curl_share_setopt "(3), " curl_share_cleanup "(3)"