Jerry Feldman wrote:
Why that? Yes, you have to be carefull about open file descriptors and memory maps (and other IPC stuff), but it should work. Apache is successfully using a mixture of threads and processes. Agreed that it should work, and does. But, you must be aware of what you get in a child process and what you do not get. For instance, when you fork(2) from a thread, the new process inherits the one thread and its state, but not any of the other threads. You also must be very careful of signals.
I came across this http://www.gnu.org/software/libc/manual/html_node/POSIX-Threads.html (see "Threads and Fork" and "Streams and Fork"), which does a pretty good job of explaining things. I guess it's difficult to say, but I would venture a guess and say if you need to fork() from a Posix thread, it is almost certainly because you expect to execv() very quickly? In my case, the fork() never caused any problems. /Per Jessen, Zürich