CURLSHOPT_UNLOCKFUNC.3 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 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.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 CURLSHOPT_UNLOCKFUNC 3 "8 Aug 2003" libcurl libcurl
  25. .SH NAME
  26. CURLSHOPT_UNLOCKFUNC - mutex unlock callback
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. void unlockcb(CURL *handle, curl_lock_data data, void *clientp);
  31. CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNLOCKFUNC, unlockcb);
  32. .fi
  33. .SH DESCRIPTION
  34. Set a mutex unlock callback for the share object. There's a corresponding
  35. \fICURLSHOPT_LOCKFUNC(3)\fP callback called when the mutex is first locked.
  36. The \fIunlockcb\fP argument must be a pointer to a function matching the
  37. prototype shown above. The arguments to the callback are:
  38. \fIhandle\fP is the currently active easy handle in use when the share object
  39. is released.
  40. The \fIdata\fP argument tells what kind of data libcurl wants to unlock. Make
  41. sure that the callback uses a different lock for each kind of data.
  42. \fIclientp\fP is the private pointer you set with \fICURLSHOPT_USERDATA\fP.
  43. This pointer is not used by libcurl itself.
  44. .SH PROTOCOLS
  45. All
  46. .SH EXAMPLE
  47. .nf
  48. CURLSHcode sh;
  49. share = curl_share_init();
  50. sh = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, mutex_unlock);
  51. if(sh)
  52. printf("Error: %s\\n", curl_share_strerror(sh));
  53. .fi
  54. .SH AVAILABILITY
  55. Added in 7.10
  56. .SH RETURN VALUE
  57. CURLSHE_OK (zero) means that the option was set properly, non-zero means an
  58. error occurred. See \fIlibcurl-errors(3)\fP for the full list with
  59. descriptions.
  60. .SH "SEE ALSO"
  61. .BR CURLSHOPT_LOCKFUNC "(3), "
  62. .BR curl_share_setopt "(3), " curl_share_cleanup "(3), " curl_share_init "(3)"