Fixes sys_waitpid() to handle concurrent waiters