ProcWait: use xmap to eliminate loops over a linked list.

Actually it was not a performance problem, as usually there are not many
subprocesses being waited for. Just cleaned up the code while debugging
another problem.