projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update RPM requires
[yaz-moved-to-github.git]
/
src
/
init_globals.c
diff --git
a/src/init_globals.c
b/src/init_globals.c
index
0800a4b
..
6bd03fb
100644
(file)
--- a/
src/init_globals.c
+++ b/
src/init_globals.c
@@
-15,6
+15,7
@@
#if YAZ_POSIX_THREADS
#include <pthread.h>
#endif
#if YAZ_POSIX_THREADS
#include <pthread.h>
#endif
+#include <errno.h>
#if HAVE_GNUTLS_H
#include <gnutls/gnutls.h>
#if HAVE_GNUTLS_H
#include <gnutls/gnutls.h>
@@
-35,6
+36,10
@@
static pthread_mutex_t yaz_init_mutex = PTHREAD_MUTEX_INITIALIZER;
extern void yaz_log_init_globals(void);
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)
void yaz_init_globals(void)
{
if (yaz_init_flag)
@@
-45,6
+50,10
@@
void yaz_init_globals(void)
if (!yaz_init_flag)
{
yaz_log_init_globals();
if (!yaz_init_flag)
{
yaz_log_init_globals();
+#if HAVE_GCRYPT_H
+ /* POSIX threads locking. In case gnutls_global_init do not override */
+ gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
#if HAVE_GNUTLS_H
gnutls_global_init();
#endif
#if HAVE_GNUTLS_H
gnutls_global_init();
#endif
@@
-55,11
+64,11
@@
void yaz_init_globals(void)
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
}
#endif
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
}
#endif
- yaz_init_flag = 1;
- }
#if YAZ_HAVE_EXSLT
#if YAZ_HAVE_EXSLT
- exsltRegisterAll();
+ exsltRegisterAll();
#endif
#endif
+ yaz_init_flag = 1; /* must be last, before unlocking */
+ }
#if YAZ_POSIX_THREADS
pthread_mutex_unlock(&yaz_init_mutex);
#endif
#if YAZ_POSIX_THREADS
pthread_mutex_unlock(&yaz_init_mutex);
#endif