Tweak waterfall update mutex locking

This commit is contained in:
Charles J. Cliffe 2015-10-20 18:30:41 -04:00
parent 0af4de4e84
commit b822704b0c

View File

@ -75,6 +75,7 @@ void WaterfallCanvas::processInputQueue() {
if (!glContext) { if (!glContext) {
return; return;
} }
tex_update.lock();
glContext->SetCurrent(*this); glContext->SetCurrent(*this);
gTimer.update(); gTimer.update();
@ -84,7 +85,6 @@ void WaterfallCanvas::processInputQueue() {
if (linesPerSecond) { if (linesPerSecond) {
if (lpsIndex >= targetVis) { if (lpsIndex >= targetVis) {
tex_update.lock();
while (lpsIndex >= targetVis) { while (lpsIndex >= targetVis) {
SpectrumVisualData *vData; SpectrumVisualData *vData;
if (!visualDataQueue.empty()) { if (!visualDataQueue.empty()) {
@ -101,9 +101,10 @@ void WaterfallCanvas::processInputQueue() {
} }
} }
waterfallPanel.update(); waterfallPanel.update();
tex_update.unlock();
} }
}} }
tex_update.unlock();
}
void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
wxPaintDC dc(this); wxPaintDC dc(this);
@ -205,6 +206,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
} }
tex_update.lock();
glContext->SetCurrent(*this); glContext->SetCurrent(*this);
initGLExtensions(); initGLExtensions();
glViewport(0, 0, ClientSize.x, ClientSize.y); glViewport(0, 0, ClientSize.x, ClientSize.y);
@ -212,9 +214,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->BeginDraw(0,0,0); glContext->BeginDraw(0,0,0);
waterfallPanel.calcTransform(CubicVR::mat4::identity()); waterfallPanel.calcTransform(CubicVR::mat4::identity());
tex_update.lock();
waterfallPanel.draw(); waterfallPanel.draw();
tex_update.unlock();
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators(); std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
@ -294,6 +294,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->EndDraw(); glContext->EndDraw();
SwapBuffers(); SwapBuffers();
tex_update.unlock();
} }
void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) { void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {