Set up handlers so `mi_thread_done` is called automatically
| 400 | |
| 401 | // Set up handlers so `mi_thread_done` is called automatically |
| 402 | static 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 | |
| 418 | bool _mi_is_main_thread(void) { |
no test coverage detected