• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_global_cleanup
5Section: 3
6Source: libcurl
7See-also:
8  - curl_global_init (3)
9  - libcurl (3)
10  - libcurl-thread (3)
11---
12
13# NAME
14
15curl_global_cleanup - global libcurl cleanup
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22void curl_global_cleanup(void);
23~~~
24
25# DESCRIPTION
26
27This function releases resources acquired by curl_global_init(3).
28
29You should call curl_global_cleanup(3) once for each call you make to
30curl_global_init(3), after you are done using libcurl.
31
32This function is thread-safe since libcurl 7.84.0 if
33curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set
34(most platforms).
35
36If this is not thread-safe, you must not call this function when any other
37thread in the program (i.e. a thread sharing the same memory) is running.
38This does not just mean no other thread that is using libcurl. Because
39curl_global_cleanup(3) calls functions of other libraries that are
40similarly thread unsafe, it could conflict with any other thread that uses
41these other libraries.
42
43See the description in libcurl(3) of global environment requirements for
44details of how to use this function.
45
46# CAUTION
47
48curl_global_cleanup(3) does not block waiting for any libcurl-created
49threads to terminate (such as threads used for name resolving). If a module
50containing libcurl is dynamically unloaded while libcurl-created threads are
51still running then your program may crash or other corruption may occur. We
52recommend you do not run libcurl from any module that may be unloaded
53dynamically. This behavior may be addressed in the future.
54
55# EXAMPLE
56
57~~~c
58int main(void)
59{
60  curl_global_init(CURL_GLOBAL_DEFAULT);
61
62  /* use libcurl, then before exiting... */
63
64  curl_global_cleanup();
65}
66~~~
67
68# AVAILABILITY
69
70Added in 7.8
71
72# RETURN VALUE
73
74None
75