1gnutls_global_init(3) gnutls gnutls_global_init(3)
2
3
4
6 gnutls_global_init - initialize the global data to defaults.
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 libgcrypt, if it has not
23 been initialized before. Thus if you want to manually initialize
24 libgcrypt you must do it before calling this function. This is useful
25 in cases you want to disable libgcrypt's internal lockings etc.
26
27 This function increment a global counter, so that
28 gnutls_global_deinit() only releases resources when it has been called
29 as many times as gnutls_global_init(). This is useful when GnuTLS is
30 used by more than one library in an application. This function can be
31 called many times, but will only do something the first time.
32
33 Note! This function is not thread safe. If two threads call this
34 function simultaneously, they can cause a race between checking the
35 global counter and incrementing it, causing both threads to execute the
36 library initialization code. That would lead to a memory leak. To
37 handle this, your application could invoke this function after aquiring
38 a thread mutex. To ignore the potential memory leak is also an option.
39
41 On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error
42 code is returned.
43
45 Report bugs to <bug-gnutls@gnu.org>. GnuTLS home page:
46 http://www.gnu.org/software/gnutls/ General help using GNU software:
47 http://www.gnu.org/gethelp/
48
50 Copyright © 2008 Free Software Foundation.
51 Copying and distribution of this file, with or without modification,
52 are permitted in any medium without royalty provided the copyright
53 notice and this notice are preserved.
54
56 The full documentation for gnutls is maintained as a Texinfo manual.
57 If the info and gnutls programs are properly installed at your site,
58 the command
59
60 info gnutls
61
62 should give you access to the complete manual.
63
64
65
66gnutls 2.8.6 gnutls_global_init(3)