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 return
} }
d.mtx.Lock() d.mtx.Lock()
defer d.mtx.Unlock()
if d.cancel == nil { if d.cancel == nil {
d.mtx.Unlock()
return return
} }
d.cancel() d.cancel()
d.cancel = nil d.cancel = nil
d.mtx.Unlock()
<-d.done <-d.done
} }