Added locking to client end of expected time service call.

This is for #108.
Added run dependency on wait_action.

Fixes #105.
Changes to how on demand tasks are handled.

The code that waited for a cancelled task had been commented out, leading to demanded tasks being ignored if something was currently executing. This addresses #108.