You would need to add `thread.join()` at the end of main, or have some RAII guard that does it for you.
In practice that's probably optional, because the heap and all resources are usually torn down with the process anyway. Important things, like saving data or committing transactions, shouldn't be done in destructors.