Move state-changing logic out of scheduler and be more explicit about waitpid-status vs. state.

On the road to #293.  This is most of what we need for #260 specifically.