481 Subj : pthreads and fork To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Sat Feb 19 2005 03:21 pm fork is supposed to leave only the calling thread in the child process. What should happen with pthread_t values and the memory associated with other threads? Is it legal to call pthread_join after fork on a pre-fork thread? I imagine one of the following is true: 1. Threads disappear and their memory is reclaimed, their pthread_t values should not be touched again, and there is no memory leak - the child process can continue. 2. Threads exit instantly, pthread_join can be used on descriptors of joinable threads to reclaim their resources. 3. It depends on the implementation, in general there is no way to release resources associated with other threads, so fork should only be called if either only one thread is running or it's soon followed by execve. Which one? Or is it something else? I'm interested both in the standards and in the practice. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ . 0