Use spin-locks for short-lived, non-recursive locking sequences

This commit is contained in:
vsonnier
2019-03-03 09:49:27 +01:00
parent 792bf20a9c
commit 5ab44e3104
12 changed files with 78 additions and 48 deletions
+3 -3
View File
@@ -88,7 +88,7 @@ void WaterfallCanvas::attachSpectrumCanvas(SpectrumCanvas *canvas_in) {
}
void WaterfallCanvas::processInputQueue() {
std::lock_guard < std::mutex > lock(tex_update);
std::lock_guard < SpinMutex > lock(tex_update);
gTimer.update();
@@ -127,7 +127,7 @@ void WaterfallCanvas::processInputQueue() {
}
void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
std::lock_guard < std::mutex > lock(tex_update);
std::lock_guard < SpinMutex > lock(tex_update);
wxPaintDC dc(this);
const wxSize ClientSize = GetClientSize();
@@ -913,7 +913,7 @@ void WaterfallCanvas::updateCenterFrequency(long long freq) {
}
void WaterfallCanvas::setLinesPerSecond(int lps) {
std::lock_guard < std::mutex > lock(tex_update);
std::lock_guard < SpinMutex > lock(tex_update);
linesPerSecond = lps;
+2 -1
View File
@@ -14,6 +14,7 @@
#include "SpectrumCanvas.h"
#include "WaterfallPanel.h"
#include "Timer.h"
#include "SpinMutex.h"
class WaterfallCanvas: public InteractiveCanvas {
public:
@@ -93,7 +94,7 @@ private:
Timer gTimer;
double lpsIndex;
bool preBuf;
std::mutex tex_update;
SpinMutex tex_update;
int minBandwidth;
std::atomic_bool fft_size_changed;
// event table