Skip to content

Commit

Permalink
Make sure to init key and dbl_key also on win32
Browse files Browse the repository at this point in the history
Hopefully fixes page fault for mingw build

Related to #2831
  • Loading branch information
wader authored and nicowilliams committed Aug 10, 2023
1 parent 765a5c7 commit 5a52553
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/jv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 5a52553

Please sign in to comment.