mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-28 13:58:30 +08:00
fix recursion issue on exit on windows, #672
This commit is contained in:
parent
37d5ce9498
commit
e68f2c1479
@ -350,7 +350,11 @@ static void _mi_thread_done(mi_heap_t* default_heap);
|
|||||||
#endif
|
#endif
|
||||||
static DWORD mi_fls_key = (DWORD)(-1);
|
static DWORD mi_fls_key = (DWORD)(-1);
|
||||||
static void NTAPI mi_fls_done(PVOID value) {
|
static void NTAPI mi_fls_done(PVOID value) {
|
||||||
if (value!=NULL) _mi_thread_done((mi_heap_t*)value);
|
mi_heap_t* heap = (mi_heap_t*)value;
|
||||||
|
if (heap != NULL) {
|
||||||
|
_mi_thread_done(heap);
|
||||||
|
FlsSetValue(mi_fls_key, NULL); // prevent recursion as _mi_thread_done may set it back to the main heap, issue #672
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#elif defined(MI_USE_PTHREADS)
|
#elif defined(MI_USE_PTHREADS)
|
||||||
// use pthread local storage keys to detect thread ending
|
// use pthread local storage keys to detect thread ending
|
||||||
|
Loading…
x
Reference in New Issue
Block a user