| 111 | cbm_thread_detach_callback; |
| 112 | |
| 113 | static DWORD WINAPI win_thread_wrapper(LPVOID lpParam) { |
| 114 | win_thread_arg_t *a = (win_thread_arg_t *)lpParam; |
| 115 | void *(*fn)(void *) = a->fn; |
| 116 | void *arg = a->arg; |
| 117 | free(a); |
| 118 | fn(arg); |
| 119 | /* Release this thread's allocator heap before the thread dies. |
| 120 | * |
| 121 | * On POSIX a pthread TSD destructor calls this for us, which is why POSIX |
| 122 | * stays flat. A static MinGW link has no DllMain and registers no TLS |
| 123 | * callback, so nothing runs at thread exit and every thread leaves its |
| 124 | * thread-heap behind for the life of the process: 607 heaps after 300 |
| 125 | * requests, 170 MiB committed against a live set of ~300 KiB, growing |
| 126 | * without bound (#581). The heaps are invisible to mi_heap_visit -- which |
| 127 | * only sees the main and calling heaps -- which is why the growth looked |
| 128 | * like it belonged to no allocator at all. */ |
| 129 | return 0; |
| 130 | } |
| 131 | |
| 132 | int cbm_thread_create(cbm_thread_t *t, size_t stack_size, void *(*fn)(void *), void *arg) { |
| 133 | if (stack_size == 0) { |
nothing calls this directly
no outgoing calls
no test coverage detected