1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLSHOPT_USERDATA
5Section: 3
6Source: libcurl
7See-also:
8  - CURLSHOPT_LOCKFUNC (3)
9  - curl_share_cleanup (3)
10  - curl_share_init (3)
11  - curl_share_setopt (3)
12Protocol:
13  - All
14Added-in: 7.10.3
15---
16
17# NAME
18
19CURLSHOPT_USERDATA - pointer passed to the lock and unlock mutex callbacks
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_USERDATA, void *clientp);
27~~~
28
29# DESCRIPTION
30
31The *clientp* parameter is held verbatim by libcurl and is passed on as
32the *clientp* argument to the callbacks set with
33CURLSHOPT_LOCKFUNC(3) and CURLSHOPT_UNLOCKFUNC(3).
34
35# %PROTOCOLS%
36
37# EXAMPLE
38
39~~~c
40struct secrets {
41  void *custom;
42};
43
44int main(void)
45{
46  CURLSHcode sh;
47  struct secrets private_stuff;
48  CURLSH *share = curl_share_init();
49  sh = curl_share_setopt(share, CURLSHOPT_USERDATA, &private_stuff);
50  if(sh)
51    printf("Error: %s\n", curl_share_strerror(sh));
52}
53~~~
54
55# %AVAILABILITY%
56
57# RETURN VALUE
58
59CURLSHE_OK (zero) means that the option was set properly, non-zero means an
60error occurred. See libcurl-errors(3) for the full list with
61descriptions.
62