curl_share_init.3 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, 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.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. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_share_init 3 "May 17, 2022" "libcurl 7.85.0" "libcurl Manual"
  25. .SH NAME
  26. curl_share_init - Create a shared object
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURLSH *curl_share_init();
  31. .fi
  32. .SH DESCRIPTION
  33. This function returns a CURLSH handle to be used as input to all the other
  34. share-functions, sometimes referred to as a share handle in some places in the
  35. documentation. This init call MUST have a corresponding call to
  36. \fIcurl_share_cleanup\fP when all operations using the share are complete.
  37. This \fIshare handle\fP is what you pass to curl using the
  38. \fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, to make that
  39. specific curl handle use the data in this share.
  40. .SH EXAMPLE
  41. .nf
  42. CURLSHcode sh;
  43. share = curl_share_init();
  44. sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
  45. if(sh)
  46. printf("Error: %s\\n", curl_share_strerror(sh));
  47. .fi
  48. .SH AVAILABILITY
  49. Added in 7.10
  50. .SH RETURN VALUE
  51. If this function returns NULL, something went wrong (out of memory, etc.)
  52. and therefore the share object was not created.
  53. .SH "SEE ALSO"
  54. .BR curl_share_cleanup "(3), " curl_share_setopt "(3)"