# HG changeset patch # User Ziv Scully # Date 1444760525 14400 # Node ID dfadb5effdc0d8113513208c9c1a352756e9f2fa # Parent 34ad83d9b729d415907f13767b0d23364c4da043# Parent ce312cad5ecda7469be0e35657dcb2305e84fef0 Merge bbaren's fix for bug 209. diff -r 34ad83d9b729 -r dfadb5effdc0 configure.ac --- a/configure.ac Wed Oct 07 08:58:08 2015 -0400 +++ b/configure.ac Tue Oct 13 14:22:05 2015 -0400 @@ -112,6 +112,22 @@ PTHREAD_LIBS="" fi +# Check if pthread_t is a scalar or pointer type so we can use the correct +# OpenSSL functions on it. +AC_MSG_CHECKING([if pthread_t is a pointer type]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]], + [[ +pthread_t a; +*a; + ]])], + AC_DEFINE([PTHREAD_T_IS_POINTER], [1], [Define if pthread_t is a pointer.]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_SUBST(CC) AC_SUBST(BIN) AC_SUBST(LIB) diff -r 34ad83d9b729 -r dfadb5effdc0 src/c/openssl.c --- a/src/c/openssl.c Wed Oct 07 08:58:08 2015 -0400 +++ b/src/c/openssl.c Tue Oct 13 14:22:05 2015 -0400 @@ -34,9 +34,15 @@ } // OpenSSL callbacks +#ifdef PTHREAD_T_IS_POINTER +# define CRYPTO_THREADID_SET CRYPTO_THREADID_set_pointer +#else +# define CRYPTO_THREADID_SET CRYPTO_THREADID_set_numeric +#endif static void thread_id(CRYPTO_THREADID *const result) { - CRYPTO_THREADID_set_numeric(result, (unsigned long)pthread_self()); + CRYPTO_THREADID_SET(result, pthread_self()); } +#undef CRYPTO_THREADID_SET static void lock_or_unlock(const int mode, const int type, const char *file, const int line) { pthread_mutex_t *const lock = &openssl_locks[type];