mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
avoid accessing the thread_id after process initialized is set
This commit is contained in:
parent
1b1c9186a4
commit
d0d47e6489
1 changed files with 3 additions and 1 deletions
|
@ -102,6 +102,7 @@ mi_decl_cache_align const mi_heap_t _mi_heap_empty = {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// the thread-local default heap for allocation
|
// the thread-local default heap for allocation
|
||||||
mi_decl_thread mi_heap_t* _mi_heap_default = (mi_heap_t*)&_mi_heap_empty;
|
mi_decl_thread mi_heap_t* _mi_heap_default = (mi_heap_t*)&_mi_heap_empty;
|
||||||
|
|
||||||
|
@ -478,10 +479,11 @@ static void mi_detect_cpu_features(void) {
|
||||||
void mi_process_init(void) mi_attr_noexcept {
|
void mi_process_init(void) mi_attr_noexcept {
|
||||||
// ensure we are called once
|
// ensure we are called once
|
||||||
if (_mi_process_is_initialized) return;
|
if (_mi_process_is_initialized) return;
|
||||||
_mi_process_is_initialized = true;
|
|
||||||
mi_process_setup_auto_thread_done();
|
mi_process_setup_auto_thread_done();
|
||||||
|
|
||||||
_mi_verbose_message("process init: 0x%zx\n", _mi_thread_id());
|
_mi_verbose_message("process init: 0x%zx\n", _mi_thread_id());
|
||||||
|
_mi_process_is_initialized = true;
|
||||||
|
|
||||||
mi_detect_cpu_features();
|
mi_detect_cpu_features();
|
||||||
_mi_os_init();
|
_mi_os_init();
|
||||||
mi_heap_main_init();
|
mi_heap_main_init();
|
||||||
|
|
Loading…
Add table
Reference in a new issue