At least on Solaris. So far. Of course, in the UNIX world good API’s tend to get migrate into other implementations, so I hope Linux hackers will take note.

6497356 fork extensions (PSARC 2006/659)

The vfork call in UNIX has always been a serious issue when you’re using threads, and the posix_spawn API did a good job of addressing that.  You can read more about this issue in one of my previous blogs.

One of the remaining major problems in trying to use fork or posix_spawn in an MT process was how to deal with the SIGCHLD signal in a sane way.  One of our resident kernel hackers has addressed that issue with some new extensions to the fork() system calls.  You can read more about it in the old OpenSolaris bugid 6497356.  In addition to causing problems in threaded programs, it made it hard to use fork/exec inside a shared library in a way that was transparent to the main application.

Basically, if you don’t want a SIGCHLD, you can opt out of the signal and then use an explicit wait() call to reap the child process.  Simple.  Of course, there are multiple fork routines, as well as the posix_spawn interface, and they all need an additional flag.