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
ZOOM: only supply clientIP for InitRequest
[yaz-moved-to-github.git]
/
src
/
init_globals.c
diff --git
a/src/init_globals.c
b/src/init_globals.c
index
81301e2
..
81cb966
100644
(file)
--- a/
src/init_globals.c
+++ b/
src/init_globals.c
@@
-24,27
+24,45
@@
#include <gcrypt.h>
#endif
#include <gcrypt.h>
#endif
+#if YAZ_HAVE_EXSLT
+#include <libexslt/exslt.h>
+#endif
+
static int yaz_init_flag = 0;
static int yaz_init_flag = 0;
+#if YAZ_POSIX_THREADS
+static pthread_mutex_t yaz_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
extern void yaz_log_init_globals(void);
void yaz_init_globals(void)
{
extern void yaz_log_init_globals(void);
void yaz_init_globals(void)
{
+ if (yaz_init_flag)
+ return;
+#if YAZ_POSIX_THREADS
+ pthread_mutex_lock(&yaz_init_mutex);
+#endif
if (!yaz_init_flag)
{
if (!yaz_init_flag)
{
- yaz_init_flag = 1;
yaz_log_init_globals();
#if HAVE_GNUTLS_H
gnutls_global_init();
#endif
#if HAVE_GCRYPT_H
yaz_log_init_globals();
#if HAVE_GNUTLS_H
gnutls_global_init();
#endif
#if HAVE_GCRYPT_H
- /* most likely, GnuTLS has initialized libgcrypt */
+ /* most likely, GnuTLS has already initialized libgcrypt */
if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
{
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
}
#endif
if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
{
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, NULL, 0);
}
#endif
+#if YAZ_HAVE_EXSLT
+ exsltRegisterAll();
+#endif
+ yaz_init_flag = 1; /* must be last, before unlocking */
}
}
+#if YAZ_POSIX_THREADS
+ pthread_mutex_unlock(&yaz_init_mutex);
+#endif
}
/*
}
/*