I tried with v5.8.8 and v5.10.0 on Fedora C9 and it works without leaving the main loop after a detached thread finishes. May be your create thread function does not actually create a thread. you can check with a simple script to verify you actually have two threads running.