From 87b1cc663749fd1f5fcdd57643bd212d9809f44f Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Tue, 27 Apr 2021 10:44:18 +0200 Subject: [PATCH] Unlock at specific points instead of deferring Signed-off-by: Arve Knudsen --- dispatch/dispatch.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dispatch/dispatch.go b/dispatch/dispatch.go index bad859bb..d62e0b8d 100644 --- a/dispatch/dispatch.go +++ b/dispatch/dispatch.go @@ -258,12 +258,13 @@ func (d *Dispatcher) Stop() { return } d.mtx.Lock() - defer d.mtx.Unlock() if d.cancel == nil { + d.mtx.Unlock() return } d.cancel() d.cancel = nil + d.mtx.Unlock() <-d.done }