From 7b35dc1bb4add8c5db287eecdf57bb872751eea3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 13 Mar 2014 14:05:36 +0100 Subject: [PATCH] Initialize gcrypt for threaded mode YAZ-751 --- src/init_globals.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/init_globals.c b/src/init_globals.c index 81cb966..79845f4 100644 --- a/src/init_globals.c +++ b/src/init_globals.c @@ -15,6 +15,7 @@ #if YAZ_POSIX_THREADS #include #endif +#include #if HAVE_GNUTLS_H #include @@ -35,6 +36,10 @@ static pthread_mutex_t yaz_init_mutex = PTHREAD_MUTEX_INITIALIZER; extern void yaz_log_init_globals(void); +#if HAVE_GCRYPT_H +GCRY_THREAD_OPTION_PTHREAD_IMPL; +#endif + void yaz_init_globals(void) { if (yaz_init_flag) @@ -52,6 +57,7 @@ void yaz_init_globals(void) /* most likely, GnuTLS has already initialized libgcrypt */ if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) { + gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0); } #endif -- 1.7.10.4