Unlock at specific points instead of deferring

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2021-04-27 10:44:18 +02:00
parent bd543f1345
commit 87b1cc6637
1 changed files with 2 additions and 1 deletions

View File

@ -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
}