Unify implementation of "CancellableRunners"
Currently there are some code duplication on types that implement a Run() (done func(), cancel func())
method.
Such duplications should be removed and ideally such types should be compatible with a new interface to be introduced:
type CancellableRunner interface {
Run() (done func(), cancel func())
}
Where Run()
should spawn the proper needed goroutines and the process should be cancellable by calling the returned non blocking cancel()
function, and it should be possible to wait for its termination by calling the blocking done()
function.