std::thread's destructor will terminate the program if you don't join or detach it before it is destroyed. std::jthread joins on destruction instead of terminating the program. Perhaps your std::thread object is being destroyed before it is detached or joined?