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

Function mi_process_setup_auto_thread_done

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

Set up handlers so `mi_thread_done` is called automatically

Source from the content-addressed store, hash-verified

400
401// Set up handlers so `mi_thread_done` is called automatically
402static void mi_process_setup_auto_thread_done(void) {
403 static bool tls_initialized = false; // fine if it races
404 if (tls_initialized) return;
405 tls_initialized = true;
406 #if defined(_WIN32) && defined(MI_SHARED_LIB)
407 // nothing to do as it is done in DllMain
408 #elif defined(_WIN32) && !defined(MI_SHARED_LIB)
409 mi_fls_key = FlsAlloc(&mi_fls_done);
410 #elif defined(MI_USE_PTHREADS)
411 mi_assert_internal(_mi_heap_default_key == (pthread_key_t)(-1));
412 pthread_key_create(&_mi_heap_default_key, &mi_pthread_done);
413 #endif
414 _mi_heap_set_default_direct(&_mi_heap_main);
415}
416
417
418bool _mi_is_main_thread(void) {

Callers 2

mi_process_loadFunction · 0.85
mi_process_initFunction · 0.85

Calls 1

Tested by

no test coverage detected