summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2020-01-09 13:03:10 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2020-01-09 13:17:11 +0100
commit5c11b5998a27f9d2b1ea1d9a207165628913c3b8 (patch)
tree2a45028e6a0fad7e4d73b1575fe8cea44a74f731
parent68d111e358061623bcc225303fe991324b135062 (diff)
downloadgnutls-5c11b5998a27f9d2b1ea1d9a207165628913c3b8.tar.gz
doc: clarify thread safeness in gnutls_global_init()
This documents and clarifies the thread safeness of gnutls_global_init() and its constraints. Resolves: #900 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--doc/cha-gtls-app.texi4
-rw-r--r--lib/global.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/cha-gtls-app.texi b/doc/cha-gtls-app.texi
index 74fed786b7..969aa5c86f 100644
--- a/doc/cha-gtls-app.texi
+++ b/doc/cha-gtls-app.texi
@@ -364,7 +364,9 @@ The GnuTLS library is initialized on load; prior to 3.3.0 was initialized by cal
The original behavior of requiring explicit initialization can obtained by setting the
GNUTLS_NO_EXPLICIT_INIT environment variable to 1, or by using the macro GNUTLS_SKIP_GLOBAL_INIT
in a global section of your program --the latter works in systems with
-support for weak symbols only.}.
+support for weak symbols only.}. @funcref{gnutls_global_init} in
+versions after 3.3.0 is thread-safe (see @ref{Thread safety}).
+
The initialization typically enables CPU-specific acceleration, performs any required
precalculations needed, opens any required system devices (e.g., /dev/urandom on Linux)
and initializes subsystems that could be used later.
diff --git a/lib/global.c b/lib/global.c
index 334148342e..b42fcb2632 100644
--- a/lib/global.c
+++ b/lib/global.c
@@ -211,7 +211,7 @@ static int _gnutls_init_ret = 0;
* called as many times as gnutls_global_init(). This is useful when
* GnuTLS is used by more than one library in an application. This
* function can be called many times, but will only do something the
- * first time.
+ * first time. It is thread safe since GnuTLS 3.3.0.
*
* A subsequent call of this function if the initial has failed will
* return the same error code.