Till recently, I was under the impression that if you \"detach\" a thread after spawning it, the thread lives even after the \"main\" thread terminates.
The pthread_detach() function marks the thread identified by thread as detached. When a detached thread terminates, its resources are automatically released back to the system without the need for another thread to join with the terminated thread.