xref: /curl/docs/libcurl/curl_share_setopt.md (revision e3fe0200)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_share_setopt
5Section: 3
6Source: libcurl
7See-also:
8  - curl_share_cleanup (3)
9  - curl_share_init (3)
10Protocol:
11  - All
12---
13
14# NAME
15
16curl_share_setopt - Set options for a shared object
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter);
24~~~
25
26# DESCRIPTION
27
28Set the *option* to *parameter* for the given *share*.
29
30# OPTIONS
31
32## CURLSHOPT_LOCKFUNC
33
34See CURLSHOPT_LOCKFUNC(3).
35
36## CURLSHOPT_UNLOCKFUNC
37
38See CURLSHOPT_UNLOCKFUNC(3).
39
40## CURLSHOPT_SHARE
41
42See CURLSHOPT_SHARE(3).
43
44## CURLSHOPT_UNSHARE
45
46See CURLSHOPT_UNSHARE(3).
47
48## CURLSHOPT_USERDATA
49
50See CURLSHOPT_USERDATA(3).
51
52# EXAMPLE
53
54~~~c
55int main(void)
56{
57  CURLSHcode sh;
58  CURLSH *share = curl_share_init();
59  sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
60  if(sh)
61    printf("Error: %s\n", curl_share_strerror(sh));
62}
63~~~
64
65# AVAILABILITY
66
67Added in 7.10
68
69# RETURN VALUE
70
71CURLSHE_OK (zero) means that the option was set properly, non-zero means an
72error occurred as *\<curl/curl.h\>* defines. See the libcurl-errors(3) man
73page for the full list with descriptions.
74