Make sure to init key and dbl_key also on win32
Hopefully fixes page fault for mingw build Related to #2831
This commit is contained in:
1 parent
765a5c77eb
commit
5a52553a3b
1 file changed
-6
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user