Ah. The POSIX-fork call.
This is how fork should work in POSIX. It's actually the reason for many of the problems. :-)
Consider this senario: Thread 1 locks a mutex, thread2 forks while the mutex is held, then tries to lock it. It will have to wait a while.
/ Per Hedbor ()
Previous text:
2002-09-04 00:23: Subject: argv[0]?
the manpage doesn't say anything specifically about malloc. Here's what's in the manual:
pid_t pth_fork(void); This is a variant of fork(2) with the difference that the current thread only is forked into a separate process, i.e., in the par- ent process nothing changes while in the child process all threads are gone except for the scheduler and the calling thread. When you really want to duplicate all threads in the current process you should use fork(2) directly. But this is usually not reason- able. Additionally this function takes care of forking handlers as established by pth_fork_push(3).
/ Marek Habersack (Grendel)