On Tuesday 09 May 2006 8:13 am, Matthias Hopf wrote:
Be very careful of using fork(2) from threads. To quote from Dave Butenhof, "Avoid using forkin a threaded program (if you can) unless you intend to exec a new program immediately". Page 197 "Programming with POSIX Threads".
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. -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9