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