CURLSHOPT_UNLOCKFUNC.3 2.6 KB

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