Make process classes more robust in multithreaded code.

We need to set the CLOEXEC flag on the file descriptors created, or the
child processes in other threads inherit the open file descriptors and we
end up in a deadlock because of it. This change assumes that pipe2()
exists on the system: if it doens't define PROCXX_HAS_PIPE2=0 and it will
fall back on a static mutex-based solution to ensure that there aren't
race conditions when setting the CLOEXEC flag.