On Thursday 09 March 2006 10:43 am, Per Jessen wrote:
Anything in particular I need to be aware of in an application that is multi-threaded, but also does regular forks? I've studied some of the stuff talked about in the man-page for pthread_atfork(), and none of it applies to my situation. I don't think I have a specific problem with fork(), I'm just trying to eliminate that option. I suggest you get Dave Butenhof's book, "Programming with POSIX Threads". This is an excellent book and Dave certainly knows his stuff since he was one of the primary threads developers for both VMS and Tru64_Unix.
If you can avoid using fork(2) in a threaded application, then do so. If you
need to use fork(2), just try to be aware that in the child, the only
thread that will exist in the child process is the thread that actually
performed the fork(2). But, the data states and mutexes should be in the
same state.
--
Jerry Feldman