Browse Source
ADSBDemodSink::processOneSample() updates m_magsqSum, m_magsqPeak, and m_magsqCount from the sample processing path, while getMagSqLevels() reads and updates the same statistics when the GUI requests the current magnitude levels. Thus, two different threads can read and write the same variables concurrently. Protect both access paths with a new m_magsqMutex to prevent concurrent updates and reads of the magnitude statistics. This eliminates the data race identified by ThreadSanitizer and prevents the GUI from observing partially updated magnitude statistics while ADS-B samples are being processed. Signed-off-by: Robin Getz <rgetz503@gmail.com>chirpmodem-v8.0.0
2 changed files with 12 additions and 4 deletions
Loading…
Reference in new issue