1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: curl_global_cleanup 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - curl_global_init (3) 9*6236dae4SAndroid Build Coastguard Worker - libcurl (3) 10*6236dae4SAndroid Build Coastguard Worker - libcurl-thread (3) 11*6236dae4SAndroid Build Coastguard WorkerProtocol: 12*6236dae4SAndroid Build Coastguard Worker - All 13*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.8 14*6236dae4SAndroid Build Coastguard Worker--- 15*6236dae4SAndroid Build Coastguard Worker 16*6236dae4SAndroid Build Coastguard Worker# NAME 17*6236dae4SAndroid Build Coastguard Worker 18*6236dae4SAndroid Build Coastguard Workercurl_global_cleanup - global libcurl cleanup 19*6236dae4SAndroid Build Coastguard Worker 20*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 21*6236dae4SAndroid Build Coastguard Worker 22*6236dae4SAndroid Build Coastguard Worker~~~c 23*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 24*6236dae4SAndroid Build Coastguard Worker 25*6236dae4SAndroid Build Coastguard Workervoid curl_global_cleanup(void); 26*6236dae4SAndroid Build Coastguard Worker~~~ 27*6236dae4SAndroid Build Coastguard Worker 28*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard WorkerThis function releases resources acquired by curl_global_init(3). 31*6236dae4SAndroid Build Coastguard Worker 32*6236dae4SAndroid Build Coastguard WorkerYou should call curl_global_cleanup(3) once for each call you make to 33*6236dae4SAndroid Build Coastguard Workercurl_global_init(3), after you are done using libcurl. 34*6236dae4SAndroid Build Coastguard Worker 35*6236dae4SAndroid Build Coastguard WorkerThis function is thread-safe since libcurl 7.84.0 if 36*6236dae4SAndroid Build Coastguard Workercurl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set 37*6236dae4SAndroid Build Coastguard Worker(most platforms). 38*6236dae4SAndroid Build Coastguard Worker 39*6236dae4SAndroid Build Coastguard WorkerIf this is not thread-safe, you must not call this function when any other 40*6236dae4SAndroid Build Coastguard Workerthread in the program (i.e. a thread sharing the same memory) is running. 41*6236dae4SAndroid Build Coastguard WorkerThis does not just mean no other thread that is using libcurl. Because 42*6236dae4SAndroid Build Coastguard Workercurl_global_cleanup(3) calls functions of other libraries that are 43*6236dae4SAndroid Build Coastguard Workersimilarly thread unsafe, it could conflict with any other thread that uses 44*6236dae4SAndroid Build Coastguard Workerthese other libraries. 45*6236dae4SAndroid Build Coastguard Worker 46*6236dae4SAndroid Build Coastguard WorkerSee the description in libcurl(3) of global environment requirements for 47*6236dae4SAndroid Build Coastguard Workerdetails of how to use this function. 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard Worker# CAUTION 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard Workercurl_global_cleanup(3) does not block waiting for any libcurl-created 52*6236dae4SAndroid Build Coastguard Workerthreads to terminate (such as threads used for name resolving). If a module 53*6236dae4SAndroid Build Coastguard Workercontaining libcurl is dynamically unloaded while libcurl-created threads are 54*6236dae4SAndroid Build Coastguard Workerstill running then your program may crash or other corruption may occur. We 55*6236dae4SAndroid Build Coastguard Workerrecommend you do not run libcurl from any module that may be unloaded 56*6236dae4SAndroid Build Coastguard Workerdynamically. This behavior may be addressed in the future. 57*6236dae4SAndroid Build Coastguard Worker 58*6236dae4SAndroid Build Coastguard Workerlibcurl may not be able to fully clean up after multi-threaded OpenSSL 59*6236dae4SAndroid Build Coastguard Workerdepending on how OpenSSL was built and loaded as a library. It is possible in 60*6236dae4SAndroid Build Coastguard Workersome rare circumstances a memory leak could occur unless you implement your own 61*6236dae4SAndroid Build Coastguard WorkerOpenSSL thread cleanup. Refer to libcurl-thread(3). 62*6236dae4SAndroid Build Coastguard Worker 63*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 64*6236dae4SAndroid Build Coastguard Worker 65*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 66*6236dae4SAndroid Build Coastguard Worker 67*6236dae4SAndroid Build Coastguard Worker~~~c 68*6236dae4SAndroid Build Coastguard Workerint main(void) 69*6236dae4SAndroid Build Coastguard Worker{ 70*6236dae4SAndroid Build Coastguard Worker curl_global_init(CURL_GLOBAL_DEFAULT); 71*6236dae4SAndroid Build Coastguard Worker 72*6236dae4SAndroid Build Coastguard Worker /* use libcurl, then before exiting... */ 73*6236dae4SAndroid Build Coastguard Worker 74*6236dae4SAndroid Build Coastguard Worker curl_global_cleanup(); 75*6236dae4SAndroid Build Coastguard Worker} 76*6236dae4SAndroid Build Coastguard Worker~~~ 77*6236dae4SAndroid Build Coastguard Worker 78*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 81*6236dae4SAndroid Build Coastguard Worker 82*6236dae4SAndroid Build Coastguard WorkerNone 83