mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-01 21:54:39 -04:00
TH_CLEAN_3: Use of non-blocking try_pop() when possible,
AudioThread concurrent access hardening and simplified, and misc.
This commit is contained in:
@@ -97,11 +97,10 @@ bool ScopeCanvas::getShowDb() {
|
||||
void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
while (!inputData.empty()) {
|
||||
ScopeRenderData *avData;
|
||||
inputData.pop(avData);
|
||||
|
||||
|
||||
ScopeRenderData *avData;
|
||||
while (inputData.try_pop(avData)) {
|
||||
|
||||
|
||||
if (!avData->spectrum) {
|
||||
scopePanel.setMode(avData->mode);
|
||||
|
||||
@@ -51,11 +51,9 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
if (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
SpectrumVisualData *vData;
|
||||
if (visualDataQueue.try_pop(vData)) {
|
||||
|
||||
if (vData) {
|
||||
spectrumPanel.setPoints(vData->spectrum_points);
|
||||
spectrumPanel.setPeakPoints(vData->spectrum_hold_points);
|
||||
|
||||
@@ -95,8 +95,8 @@ void WaterfallCanvas::processInputQueue() {
|
||||
if (lpsIndex >= targetVis) {
|
||||
while (lpsIndex >= targetVis) {
|
||||
SpectrumVisualData *vData;
|
||||
if (!visualDataQueue.empty()) {
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (visualDataQueue.try_pop(vData)) {
|
||||
|
||||
if (vData) {
|
||||
if (vData->spectrum_points.size() == fft_size * 2) {
|
||||
@@ -912,11 +912,13 @@ void WaterfallCanvas::updateCenterFrequency(long long freq) {
|
||||
|
||||
void WaterfallCanvas::setLinesPerSecond(int lps) {
|
||||
std::lock_guard < std::mutex > lock(tex_update);
|
||||
|
||||
linesPerSecond = lps;
|
||||
while (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
//empty all
|
||||
SpectrumVisualData *vData;
|
||||
while (visualDataQueue.try_pop(vData)) {
|
||||
|
||||
if (vData) {
|
||||
vData->decRefCount();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user