1gnutls_global_init(3) gnutls gnutls_global_init(3)
2
3
4
6 gnutls_global_init - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_global_init( void);
12
14 void
15
17 This function initializes the global data to defaults. Every gnutls
18 application has a global data which holds common parameters shared by
19 gnutls session structures. You should call gnutls_global_deinit() when
20 gnutls usage is no longer needed
21
22 Note that this function will also initialize the underlying crypto
23 backend, if it has not been initialized before.
24
25 This function increment a global counter, so that
26 gnutls_global_deinit() only releases resources when it has been called
27 as many times as gnutls_global_init(). This is useful when GnuTLS is
28 used by more than one library in an application. This function can be
29 called many times, but will only do something the first time.
30
31 Note! This function is not thread safe. If two threads call this
32 function simultaneously, they can cause a race between checking the
33 global counter and incrementing it, causing both threads to execute the
34 library initialization code. That would lead to a memory leak. To
35 handle this, your application could invoke this function after aquiring
36 a thread mutex. To ignore the potential memory leak is also an option.
37
39 On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error
40 code is returned.
41
43 Report bugs to <bug-gnutls@gnu.org>. GnuTLS home page:
44 http://www.gnu.org/software/gnutls/ General help using GNU software:
45 http://www.gnu.org/gethelp/
46
48 Copyright © 2008 Free Software Foundation.
49 Copying and distribution of this file, with or without modification,
50 are permitted in any medium without royalty provided the copyright
51 notice and this notice are preserved.
52
54 The full documentation for gnutls is maintained as a Texinfo manual.
55 If the info and gnutls programs are properly installed at your site,
56 the command
57
58 info gnutls
59
60 should give you access to the complete manual.
61
62
63
64gnutls 2.12.6.1 gnutls_global_init(3)