xref: /curl/docs/libcurl/curl_share_cleanup.md (revision e3fe0200)
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
12---
13
14# NAME
15
16curl_share_cleanup - Clean up a shared object
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLSHcode curl_share_cleanup(CURLSH *share_handle);
24~~~
25
26# DESCRIPTION
27
28This function deletes a shared object. The share handle cannot be used anymore
29when this function has been called.
30
31Passing in a NULL pointer in *share_handle* makes this function return
32immediately with no action.
33
34# EXAMPLE
35
36~~~c
37int main(void)
38{
39  CURLSHcode sh;
40  CURLSH *share = curl_share_init();
41  sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
42  /* use the share, then ... */
43  curl_share_cleanup(share);
44}
45~~~
46
47# AVAILABILITY
48
49Added in 7.10
50
51# RETURN VALUE
52
53CURLSHE_OK (zero) means that the option was set properly, non-zero means an
54error occurred as *\<curl/curl.h\>* defines. See the libcurl-errors(3) man
55page for the full list with descriptions. If an error occurs, then the share
56object is not deleted.
57