Consume all tokens before terminating.

This patch fixes a bug under condition variable
signaling where a child terminates before consuming
all input tokens. A child should only terminate after
it has run out of work. Further, it should not signal
its own children to terminate either.
Thus, the termiante signal is delayed until a node
consumes all of its tokens.