CURLSHOPT_UNLOCKFUNC.3 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .\" generated by cd2nroff 0.1 from CURLSHOPT_UNLOCKFUNC.md
  2. .TH CURLSHOPT_UNLOCKFUNC 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLSHOPT_UNLOCKFUNC \- mutex unlock callback
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. void unlockcb(CURL *handle, curl_lock_data data, void *clientp);
  9. CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNLOCKFUNC, unlockcb);
  10. .fi
  11. .SH DESCRIPTION
  12. Set a mutex unlock callback for the share object. There is a corresponding
  13. \fICURLSHOPT_LOCKFUNC(3)\fP callback called when the mutex is first locked.
  14. The \fIunlockcb\fP argument must be a pointer to a function matching the
  15. prototype shown above. The arguments to the callback are:
  16. \fIhandle\fP is the currently active easy handle in use when the share object
  17. is released.
  18. The \fIdata\fP argument tells what kind of data libcurl wants to unlock. Make
  19. sure that the callback uses a different lock for each kind of data.
  20. \fIclientp\fP is the private pointer you set with \fICURLSHOPT_USERDATA(3)\fP.
  21. This pointer is not used by libcurl itself.
  22. .SH PROTOCOLS
  23. This functionality affects all supported protocols
  24. .SH EXAMPLE
  25. .nf
  26. extern void mutex_unlock(CURL *, curl_lock_data, void *);
  27. int main(void)
  28. {
  29. CURLSHcode sh;
  30. CURLSH *share = curl_share_init();
  31. sh = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, mutex_unlock);
  32. if(sh)
  33. printf("Error: %s\\n", curl_share_strerror(sh));
  34. }
  35. .fi
  36. .SH AVAILABILITY
  37. Added in curl 7.10.3
  38. .SH RETURN VALUE
  39. CURLSHE_OK (zero) means that the option was set properly, non\-zero means an
  40. error occurred. See \fIlibcurl\-errors(3)\fP for the full list with
  41. descriptions.
  42. .SH SEE ALSO
  43. .BR CURLSHOPT_LOCKFUNC (3),
  44. .BR curl_share_cleanup (3),
  45. .BR curl_share_init (3),
  46. .BR curl_share_setopt (3)