This now allows any number of
addInputs to be run concurrently, but ensures that everything in
runTask(up to the
failover.setcall, at least) is fully synchronized. Inputs are handled on a first-come-first-served basis. If
noMoreInputsis called after all inputs are added, then exactly one of
noInputSucceededwill run to perform whatever cleanup is necessary.
I call this the "failover trigger" pattern because it provides each task with a trigger it can use to optionally start the next task.