Add a stop condition to `StreamManager.run`.

When this stop condition function returns True, the loop should terminate and
return control to the caller.