From 81cb86bb7bc353a10958edbe59bf2e6ddc266d44 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 20 Apr 2017 16:34:56 +0200 Subject: doc: clarifications on custom thread override [ci skip] Signed-off-by: Nikos Mavrogiannopoulos --- doc/cha-gtls-app.texi | 7 ++++--- lib/locks.c | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/cha-gtls-app.texi b/doc/cha-gtls-app.texi index 8b417d6f00..8fcb6dfe0a 100644 --- a/doc/cha-gtls-app.texi +++ b/doc/cha-gtls-app.texi @@ -352,15 +352,16 @@ library. The GnuTLS library is initialized on load; prior to 3.3.0 was initialized by calling @funcref{gnutls_global_init}@footnote{ 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.}. +in a global section of your program --the latter works in systems with +support for weak symbols only.}. 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. The resources allocated by the initialization process will be released -on library deinitialization, or explicitly by calling @funcref{gnutls_global_deinit}. +on library deinitialization. -Note that during initialization file descriptors may be kept open by +Note that on certain systems file descriptors may be kept open by GnuTLS (e.g. /dev/urandom) on library load. Applications closing all unknown file descriptors must immediately call @funcref{gnutls_global_init}, after that, to ensure they don't disrupt GnuTLS' operation. diff --git a/lib/locks.c b/lib/locks.c index 8b94b6c62a..494199a5a1 100644 --- a/lib/locks.c +++ b/lib/locks.c @@ -43,6 +43,10 @@ * unless really needed to. GnuTLS will use the appropriate locks for the running * system. * + * Note that since the move to implicit initialization of GnuTLS on library + * load, calling this function will deinitialize the library, and re-initialize + * it after the new locking functions are set. + * * This function must be called prior to any other gnutls function. * * Since: 2.12.0 -- cgit v1.2.1