Skip to content

Commit

Permalink
Moved the mutex closer to the action!
Browse files Browse the repository at this point in the history
  • Loading branch information
berndporr committed Feb 11, 2024
1 parent 6b01141 commit 15a3cf7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 15a3cf7

Please sign in to comment.