diff --git a/dispatch/dispatch.go b/dispatch/dispatch.go index b030046d..bad859bb 100644 --- a/dispatch/dispatch.go +++ b/dispatch/dispatch.go @@ -258,12 +258,12 @@ func (d *Dispatcher) Stop() { return } d.mtx.Lock() + defer d.mtx.Unlock() if d.cancel == nil { return } d.cancel() d.cancel = nil - d.mtx.Unlock() <-d.done }