Skip to content
Myr

Mutex protect buffer access in standard renderer

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 ac28669 · Browse files · 1 file+3 added−3 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+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:standard_renderer.go+3 added-3 removed
86 unmodified lines
87}8889// flush renders the buffer.90func (r *standardRenderer) flush() {91 r.mtx.Lock()92 defer r.mtx.Unlock()9394 if r.buf.Len() == 0 || r.buf.String() == r.lastRender {95 // Nothing to do96 return97 }9899 out := new(bytes.Buffer)10098 r.mtx.Lock()99 defer r.mtx.Unlock()100101 // Clear any lines we painted in the last render.102 if r.linesRendered > 0 {103 for i := r.linesRendered - 1; i > 0; i-- {104 // Check if we should skip rendering for this line. Clearing the
294 unmodified lines