It is expected that threads, on which pthread_detach()
was not called, should be pthread_join()
ed before the main thread returns from main()
or calls exit()
.
However, what happens when this requirement is not met? What happens when a process terminates when it still contains unjoined and not detached threads?
I would find it odd to learn that these other threads’ resources will not be reclaimed until system reboot. However, if these resources will be reclaimed, then there may be little need to bother about joining or detaching, mightn’t it?