summaryrefslogtreecommitdiffstats
path: root/src/jv_dtoa_tsd.c
diff options
context:
space:
mode:
authorMattias Wadman <mattias.wadman@gmail.com>2023-08-10 18:53:50 +0200
committerGitHub <noreply@github.com>2023-08-10 18:53:50 +0200
commit765a5c77eb919bca04a20c000b8a1df65f8d81eb (patch)
tree36f251aec82c746c1fc40094290bd58de3f6a279 /src/jv_dtoa_tsd.c
parentd1a6da22054fc249ae4cbe04402709b029101786 (diff)
Make sure to init dtoa_ctx_key also on win32 (#2834)
Fixes page fault for mingw build Related to #2831
Diffstat (limited to 'src/jv_dtoa_tsd.c')
-rw-r--r--src/jv_dtoa_tsd.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/jv_dtoa_tsd.c b/src/jv_dtoa_tsd.c
index cfccd40c..4bea31b5 100644
--- a/src/jv_dtoa_tsd.c
+++ b/src/jv_dtoa_tsd.c
@@ -6,9 +6,7 @@
#include "jv_dtoa.h"
#include "jv_alloc.h"
-#ifndef WIN32
static pthread_once_t dtoa_ctx_once = PTHREAD_ONCE_INIT;
-#endif
static pthread_key_t dtoa_ctx_key;
static void tsd_dtoa_ctx_dtor(void *ctx) {
@@ -35,15 +33,11 @@ void jv_tsd_dtoa_ctx_init() {
fprintf(stderr, "error: cannot create thread specific key");
abort();
}
-#ifndef WIN32
atexit(jv_tsd_dtoa_ctx_fini);
-#endif
}
inline struct dtoa_context *tsd_dtoa_context_get() {
-#ifndef WIN32
pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
-#endif
struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
if (!ctx) {
ctx = malloc(sizeof(struct dtoa_context));