Dispatch: Make sure mutex gets unlocked on call to Stop

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2021-04-27 09:25:16 +02:00
parent 194f1cfd7c
commit bd543f1345
1 changed files with 1 additions and 1 deletions

View File

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