Skip to content
Myr

fix: stop renderer before acquiring renderer mutex

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Muehlhaeuser · committed by Christian Muehlhaeuser · parent 444e04b · Browse files · 1 file+10 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−6 removed

  • other:+10 added−6 removed

1 file+10 added−6 removed

modified:standard_renderer.go+10 added-6 removed
86 unmodified lines
87}8889// stop permanently halts the renderer, rendering the final frame.90func (r *standardRenderer) stop() {91 // Stop the renderer before acquiring the mutex to avoid a deadlock.92 r.once.Do(func() {93 r.done <- struct{}{}94 })9596 // flush locks the mutex97 r.flush()9899 r.mtx.Lock()100 defer r.mtx.Unlock()101102 r.out.ClearLine()98 r.once.Do(func() {99 r.done <- struct{}{}100 })103104 if r.useANSICompressor {105 if w, ok := r.out.TTY().(io.WriteCloser); ok {106 _ = w.Close()
2 unmodified lines
109}110111// kill halts the renderer. The final frame will not be rendered.112func (r *standardRenderer) kill() {113 // Stop the renderer before acquiring the mutex to avoid a deadlock.114 r.once.Do(func() {115 r.done <- struct{}{}116 })117118 r.mtx.Lock()119 defer r.mtx.Unlock()120121 r.out.ClearLine()115 r.once.Do(func() {116 r.done <- struct{}{}117 })122}123124// listen waits for ticks on the ticker, or a signal to stop the renderer.125func (r *standardRenderer) listen() {
536 unmodified lines