CURLSHOPT_UNLOCKFUNC(3)
π CURLSHOPT_UNLOCKFUNC π
okay so bestie, welcome to the Library Functions Manual page for CURLSHOPT_UNLOCKFUNC β it's the mutex unlock callback situation in libcurl, and yes it matters π«Άβ¨
πΈ NAME πΈ
CURLSHOPT_UNLOCKFUNC β mutex unlock callback β¨
β¨ SYNOPSIS β¨
#include <curl/curl.h>
void unlockcb(CURL *handle, curl_lock_data data, void *clientp);
CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNLOCKFUNC, unlockcb);
π¦ DESCRIPTION π¦
Set a mutex unlock callback for the share object. There's a corresponding CURLSHOPT_LOCKFUNC(3) callback that gets called when the mutex is first locked β iconic pairing π
.
The unlockcb argument has to be a pointer to a function matching the prototype shown above. The arguments your callback receives are:
handleβ the currently active easy handle in use when the share object is released π.dataβ tells you what kind of data libcurl wants to unlock. Make sure that the callback uses a different lock for each kind of data, fr fr π«Ά.clientpβ the private pointer you set withCURLSHOPT_USERDATA(3). This pointer is not used by libcurl itself π.
π PROTOCOLS π
This functionality affects all supported protocols. all of them, periodt πβ¨
π EXAMPLE π
extern void mutex_unlock(CURL *, curl_lock_data, void *);
int main(void)
{
CURLSHcode sh;
CURLSH *share = curl_share_init();
sh = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, mutex_unlock);
if(sh)
printf("Error: %s\n", curl_share_strerror(sh));
}
β AVAILABILITY β
Added in curl 7.10.3 β vintage but iconic π.
π RETURN VALUE π
CURLSHE_OK (zero) means that the option was set properly. Non-zero means an error occurred π. See libcurl-errors(3) for the full list with descriptions β that's your error-decoder bestie.
π SEE ALSO π
mwah π this page is from libcurl, dated 2026-10-12, and it's the CURLSHOPT_UNLOCKFUNC(3) manual-page moment. bye bestie π«Άπ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms