MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_thread_init

Function mi_thread_init

3rd/mimalloc-2.0.9/src/init.c:429–442  ·  view source on GitHub ↗

This is called from the `mi_malloc_generic`

Source from the content-addressed store, hash-verified

427
428// This is called from the `mi_malloc_generic`
429void mi_thread_init(void) mi_attr_noexcept
430{
431 // ensure our process has started already
432 mi_process_init();
433
434 // initialize the thread local default heap
435 // (this will call `_mi_heap_set_default_direct` and thus set the
436 // fiber/pthread key to a non-zero value, ensuring `_mi_thread_done` is called)
437 if (_mi_heap_init()) return; // returns true if already initialized
438
439 _mi_stat_increase(&_mi_stats_main.threads, 1);
440 mi_atomic_increment_relaxed(&thread_count);
441 //_mi_verbose_message("thread init: 0x%zx\n", _mi_thread_id());
442}
443
444void mi_thread_done(void) mi_attr_noexcept {
445 _mi_thread_done(mi_get_default_heap());

Callers 3

mi_process_initFunction · 0.85
mi_heap_get_defaultFunction · 0.85
_mi_malloc_genericFunction · 0.85

Calls 3

mi_process_initFunction · 0.85
_mi_heap_initFunction · 0.85
_mi_stat_increaseFunction · 0.85

Tested by

no test coverage detected