Skip to content
Myr

Make sure to init dtoa_ctx_key also on win32 (#2834)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes page fault for mingw build Related to #2831

authored by Mattias Wadman · committed by GitHub · parent d1a6da2 · Browse files · 1 file+0 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+0 added−6 removed

  • other:+0 added−6 removed

1 file+0 added−6 removed

modified:src/jv_dtoa_tsd.c-6 removed
4 unmodified lines
5#include "jv_dtoa_tsd.h"6#include "jv_dtoa.h"7#include "jv_alloc.h"89#ifndef WIN329static pthread_once_t dtoa_ctx_once = PTHREAD_ONCE_INIT;11#endif1011static pthread_key_t dtoa_ctx_key;12static void tsd_dtoa_ctx_dtor(void *ctx) {13 if (ctx) {
18 unmodified lines
32 if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) {33 fprintf(stderr, "error: cannot create thread specific key");34 abort();35 }38#ifndef WIN3236 atexit(jv_tsd_dtoa_ctx_fini);40#endif37}3839inline struct dtoa_context *tsd_dtoa_context_get() {44#ifndef WIN3240 pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail46#endif41 struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);42 if (!ctx) {43 ctx = malloc(sizeof(struct dtoa_context));44 jvp_dtoa_context_init(ctx);
7 unmodified lines