Wq policy loop

Implements the skeleton for dispatch/receive policies. 

Right now the behavior is almost the same as the old one, with the difference that sequences of send or receive tasks are split according to stoptime. This makes wq_wait more responsive from the user perspective, as it returns more often.

@nhazekam, @dpandiar, @dthain, @rampantmonkey