diff options
-rw-r--r-- | crypto/threads_win.c | 27 | ||||
-rw-r--r-- | include/openssl/crypto.h | 7 |
2 files changed, 5 insertions, 29 deletions
diff --git a/crypto/threads_win.c b/crypto/threads_win.c index ff4aae4f32..545b9beb87 100644 --- a/crypto/threads_win.c +++ b/crypto/threads_win.c @@ -55,12 +55,14 @@ void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock) return; } -# if _WIN32_WINNT < 0x0600 - # define ONCE_UNINITED 0 # define ONCE_ININIT 1 # define ONCE_DONE 2 +/* + * We don't use InitOnceExecuteOnce because that isn't available in WinXP which + * we still have to support. + */ int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) { LONG volatile *lock = (LONG *)once; @@ -81,27 +83,6 @@ int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) return (*lock == ONCE_DONE); } -# else - -BOOL CALLBACK once_cb(PINIT_ONCE once, PVOID p, PVOID *pp) -{ - void (*init)(void) = p; - - init(); - - return TRUE; -} - -int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) -{ - if (InitOnceExecuteOnce(once, once_cb, init, NULL)) - return 1; - - return 0; -} - -# endif - int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) { *key = TlsAlloc(); diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index 1162c71041..84c479cc3c 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -396,13 +396,8 @@ typedef unsigned int CRYPTO_THREAD_ID; typedef DWORD CRYPTO_THREAD_LOCAL; typedef DWORD CRYPTO_THREAD_ID; -# if _WIN32_WINNT < 0x0600 typedef LONG CRYPTO_ONCE; -# define CRYPTO_ONCE_STATIC_INIT 0 -# else -typedef INIT_ONCE CRYPTO_ONCE; -# define CRYPTO_ONCE_STATIC_INIT INIT_ONCE_STATIC_INIT -# endif +# define CRYPTO_ONCE_STATIC_INIT 0 # else # include <pthread.h> |