From 15a3cf7504c923b2e964827144fd46970b89533f Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Sun, 11 Feb 2024 23:42:01 +0000 Subject: [PATCH] Moved the mutex closer to the action! --- window.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/window.cpp b/window.cpp index 86e52db..2cb6891 100644 --- a/window.cpp +++ b/window.cpp @@ -67,20 +67,21 @@ void Window::reset() { } +// add the new input to the plot void Window::hasData(double inVal) { mtx.lock(); - // add the new input to the plot std::move( yData, yData + plotDataSize - 1, yData+1 ); yData[0] = inVal; mtx.unlock(); } +// screen refresh void Window::timerEvent( QTimerEvent * ) { mtx.lock(); curve->setSamples(xData, yData, plotDataSize); thermo->setValue( fabs(yData[0]) ); + mtx.unlock(); plot->replot(); update(); - mtx.unlock(); }