> Eric Blake wrote: > > Although it gets prohibitively expensive in a multi-threaded process to > > ensure proper locking between all threads that might want to use > > posix_spawn > > Why locking? posix_spawn uses fork() - the vfork() optimization is not > possible in the case when there are file actions
The glibc implementation uses clone() on Linux regardless of whether there are file actions, which should give performance closer to vfork() than fork(). https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/spawni.c -- Tavian Barnes