Giovanni Mascellani (@giomasce) commented about dlls/ntdll/unix/loader.c:
+ return 0; +} + +/*********************************************************************** + * start_main_thread + */ +static void start_main_thread(void) +{ + static sigset_t blocked_signals; + pthread_t thread; + + /* block all signals for this thread, it cannot handle them */ + sigfillset( &blocked_signals ); + pthread_sigmask( SIG_BLOCK, &blocked_signals, NULL ); + pthread_create( &thread, NULL, pthread_main_wrapper, &blocked_signals ); + pthread_exit( NULL ); Yeah, that's what I was suggesting, but you still need to call `pthread_detach()` on the newly created thread. If a thread is neither detached nor joined, its resources are never claimed back, much akin to a child which is never waited upon (AFAIU).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1088#note_23289