1CURLSHOPT_LOCKFUNC(3)           libcurl Manual           CURLSHOPT_LOCKFUNC(3)
2
3
4

NAME

6       CURLSHOPT_LOCKFUNC - mutex lock callback
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       void lockcb(CURL *handle, curl_lock_data data, curl_lock_access access,
12                   void *userptr);
13
14       CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_LOCKFUNC, lockcb);
15

DESCRIPTION

17       Set a mutex lock callback for the share object, to allow it to get used
18       by multiple threads concurrently. There's a corresponding CURLSHOPT_UN‐
19       LOCKFUNC(3) callback called when the mutex is again released.
20
21       The lockcb argument must be a pointer to a function matching the proto‐
22       type shown above. The arguments to the callback are:
23
24       handle is the currently active easy handle in use when the share object
25       is intended to get used.
26
27       The  data  argument tells what kind of data libcurl wants to lock. Make
28       sure that the callback uses a different lock for each kind of data.
29
30       access defines what access type libcurl wants, shared or single.
31
32       userptr is the private pointer you set with  CURLSHOPT_USERDATA.   This
33       pointer is not used by libcurl itself.
34

PROTOCOLS

36       All
37

EXAMPLE

39         CURLSHcode sh
40         share = curl_share_init();
41         sh = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, mutex_lock);
42         if(sh)
43           printf("Error: %s\n", curl_share_strerror(sh));
44

AVAILABILITY

46       Added in 7.10
47

RETURN VALUE

49       CURLSHE_OK  (zero)  means  that  the  option was set properly, non-zero
50       means an error occurred. See libcurl-errors(3) for the full  list  with
51       descriptions.
52

SEE ALSO

54       CURLSHOPT_UNLOCKFUNC(3),  curl_share_setopt(3),  curl_share_cleanup(3),
55       curl_share_init(3)
56
57
58
59libcurl 7.82.0                 January 31, 2022          CURLSHOPT_LOCKFUNC(3)
Impressum