xref: /curl/docs/libcurl/curl_share_cleanup.md (revision 1e769526)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_share_cleanup
5Section: 3
6Source: libcurl
7See-also:
8  - curl_share_init (3)
9  - curl_share_setopt (3)
10Protocol:
11  - All
12Added-in: 7.10
13---
14
15# NAME
16
17curl_share_cleanup - close a shared object
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLSHcode curl_share_cleanup(CURLSH *share_handle);
25~~~
26
27# DESCRIPTION
28
29This function deletes a shared object. The share handle cannot be used anymore
30when this function has been called.
31
32Passing in a NULL pointer in *share_handle* makes this function return
33immediately with no action.
34
35Any use of the **share_handle** after this function has been called and have
36returned, is illegal.
37
38# %PROTOCOLS%
39
40# EXAMPLE
41
42~~~c
43int main(void)
44{
45  CURLSHcode sh;
46  CURLSH *share = curl_share_init();
47  sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
48  /* use the share, then ... */
49  curl_share_cleanup(share);
50}
51~~~
52
53# %AVAILABILITY%
54
55# RETURN VALUE
56
57CURLSHE_OK (zero) means that the option was set properly, non-zero means an
58error occurred as *\<curl/curl.h\>* defines. See the libcurl-errors(3) man
59page for the full list with descriptions. If an error occurs, then the share
60object is not deleted.
61