Skip to content

Commit

Permalink
Remove redundant lock in listen
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyonlin authored and muesli committed Apr 8, 2021
1 parent 1ee4050 commit 2d602a1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions standard_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (r *standardRenderer) start() {
func (r *standardRenderer) stop() {
r.flush()
clearLine(r.out)
r.done <- struct{}{}
close(r.done)
}

// listen waits for ticks on the ticker, or a signal to stop the renderer.
Expand All @@ -77,11 +77,8 @@ func (r *standardRenderer) listen() {
r.flush()
}
case <-r.done:
r.mtx.Lock()
r.ticker.Stop()
r.ticker = nil
r.mtx.Unlock()
close(r.done)
return
}
}
Expand Down

0 comments on commit 2d602a1

Please sign in to comment.