try locking reader while processing results.

main
DustyP 9 months ago
parent 1374d2c179
commit b52a425754

@ -219,6 +219,7 @@ func (dc *DerbyClock) readLoop() {
if b[0] == ' ' { if b[0] == ' ' {
// These characters could indicate a complete result or a separator // These characters could indicate a complete result or a separator
// Try to extract a result from the buffer // Try to extract a result from the buffer
dc.mu.Lock()
result := dc.tryExtractResult(buffer) result := dc.tryExtractResult(buffer)
if result != nil { if result != nil {
// Send lane finish event // Send lane finish event
@ -229,6 +230,7 @@ func (dc *DerbyClock) readLoop() {
} }
// Clear the buffer after a result is extracted // Clear the buffer after a result is extracted
buffer = buffer[:0] buffer = buffer[:0]
dc.mu.Unlock()
} }
} }

Loading…
Cancel
Save