Skip to content

Commit

Permalink
apps/radar/Lucid/MetRecord - adding mutex for checking status
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dixon committed Dec 31, 2024
1 parent 9871d6e commit 4ca43f0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 12 additions & 2 deletions codebase/apps/radar/src/Lucid/MetRecord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
//
///////////////////////////////////////////////////////////////

#include <QMutexLocker>
#include <qtplot/ColorMap.hh>
#include "cidd.h"
#include "MetRecord.hh"
Expand Down Expand Up @@ -629,22 +630,31 @@ string MetRecord::_getFieldName()
// is the data valid?

bool MetRecord::isValidH() const {
QMutexLocker locker(&_statusMutex);
return _validH;
}

bool MetRecord::isValidV() const {
QMutexLocker locker(&_statusMutex);
return _validV;
}

//////////////////////////////////////////////////////
// is the data new?
// if new is true, sets to false and returns true

bool MetRecord::isNewH() const {
return _newH;
QMutexLocker locker(&_statusMutex);
bool isNew = _newH;
_newH = false;
return isNew;
}

bool MetRecord::isNewV() const {
return _newV;
QMutexLocker locker(&_statusMutex);
bool isNew = _newV;
_newV = false;
return isNew;
}


10 changes: 8 additions & 2 deletions codebase/apps/radar/src/Lucid/MetRecord.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@
#ifndef MET_RECORD_HH
#define MET_RECORD_HH

#include <QMutex>

#include <toolsa/DateTime.hh>
#include <toolsa/mem.h>
#include <Mdv/DsMdvxThreaded.hh>
#include <Mdv/DsMdvx.hh>

#include "cidd_macros.h"
#include "cidd_structs.h"
#include "cidd_colorscales.h"
Expand All @@ -63,6 +66,7 @@ public:
bool isValidV() const;

// is the data new?
// if new is true, sets to false and returns true

bool isNewH() const;
bool isNewV() const;
Expand Down Expand Up @@ -186,15 +190,17 @@ public:

private:

mutable QMutex _statusMutex;

// data request details

DateTime _timeReq;
ZoomBox _zoomBoxReq; // horiz data
double _zlevelReq; // horiz data
WayPts _wayPtsReq; // vert section data

bool _validH, _validV;
bool _newH, _newV;
mutable bool _newH, _newV;

// data status

Expand Down

0 comments on commit 4ca43f0

Please sign in to comment.