use a PID -> exit code map to avoid race conditions.