common: Improve waiting for processes on POSIX.