aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2009-12-08 09:31:06 +0000
committerVincent Richard <[email protected]>2009-12-08 09:31:06 +0000
commit6016fd5879638208a2f6db6fd0fc60300871c27b (patch)
treef9cea1d197e4762f60dc042524671cc162a60526
parentFixed compilation issue with Intel Compiler (thanks to Eric Trinh for report). (diff)
downloadvmime-6016fd5879638208a2f6db6fd0fc60300871c27b.tar.gz
vmime-6016fd5879638208a2f6db6fd0fc60300871c27b.zip
Initialize multi-threading for GNUTLS/GCrypt (thanks to Bartek Szurgot).
-rw-r--r--src/net/tls/TLSSession.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/net/tls/TLSSession.cpp b/src/net/tls/TLSSession.cpp
index 1146d1b6..d4eab3e6 100644
--- a/src/net/tls/TLSSession.cpp
+++ b/src/net/tls/TLSSession.cpp
@@ -24,6 +24,13 @@
#include <gnutls/gnutls.h>
#include <gnutls/extra.h>
+#include "vmime/config.hpp"
+
+#if VMIME_HAVE_PTHREAD
+# include <gcrypt.h>
+# include <errno.h>
+#endif // VMIME_HAVE_PTHREAD
+
#include "vmime/net/tls/TLSSession.hpp"
#include "vmime/exception.hpp"
@@ -38,6 +45,14 @@
#endif // VMIME_DEBUG && GNUTLS_DEBUG
+#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
+extern "C"
+{
+ GCRY_THREAD_OPTION_PTHREAD_IMPL;
+}
+#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
+
+
namespace vmime {
namespace net {
namespace tls {
@@ -50,6 +65,10 @@ struct TLSGlobal
{
TLSGlobal()
{
+#if VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL)
+ gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif // VMIME_HAVE_PTHREAD && defined(GCRY_THREAD_OPTION_PTHREAD_IMPL
+
gnutls_global_init();
//gnutls_global_init_extra();