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