From 5a52553a3be6ef3e44928cab20f96cdaa3e8b5dc Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Thu, 10 Aug 2023 19:13:58 +0200 Subject: [PATCH] Make sure to init key and dbl_key also on win32 Hopefully fixes page fault for mingw build Related to #2831 --- src/jv.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/jv.c b/src/jv.c index cd2c1ac1a3..ddc2948a79 100644 --- a/src/jv.c +++ b/src/jv.c @@ -490,9 +490,7 @@ pthread_getspecific(pthread_key_t key) static pthread_key_t dec_ctx_key; static pthread_key_t dec_ctx_dbl_key; -#ifndef WIN32 static pthread_once_t dec_ctx_once = PTHREAD_ONCE_INIT; -#endif #define DEC_CONTEXT() tsd_dec_ctx_get(&dec_ctx_key) #define DEC_CONTEXT_TO_DOUBLE() tsd_dec_ctx_get(&dec_ctx_dbl_key) @@ -515,15 +513,11 @@ void jv_tsd_dec_ctx_init() { fprintf(stderr, "error: cannot create thread specific key"); abort(); } -#ifndef WIN32 atexit(jv_tsd_dec_ctx_fini); -#endif } static decContext* tsd_dec_ctx_get(pthread_key_t *key) { -#ifndef WIN32 pthread_once(&dec_ctx_once, jv_tsd_dec_ctx_init); // cannot fail -#endif decContext *ctx = (decContext*)pthread_getspecific(*key); if (ctx) { return ctx;