mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-29 20:50:04 +00:00
Merge pull request #508 from dpaulat/hotfix/level2-elevation-race-condition
Some checks failed
CI / macos_clang18_arm64 (push) Has been cancelled
CI / macos_clang18_x64 (push) Has been cancelled
CI / windows_msvc2022_x64 (push) Has been cancelled
CI / linux_gcc_arm64 (push) Has been cancelled
CI / linux_clang_x64 (push) Has been cancelled
CI / linux_gcc_x64 (push) Has been cancelled
Some checks failed
CI / macos_clang18_arm64 (push) Has been cancelled
CI / macos_clang18_x64 (push) Has been cancelled
CI / windows_msvc2022_x64 (push) Has been cancelled
CI / linux_gcc_arm64 (push) Has been cancelled
CI / linux_clang_x64 (push) Has been cancelled
CI / linux_gcc_x64 (push) Has been cancelled
Elevation cuts needs protected by mutex
This commit is contained in:
commit
d218d05184
1 changed files with 14 additions and 2 deletions
|
|
@ -8,6 +8,9 @@
|
||||||
#include <scwx/util/threads.hpp>
|
#include <scwx/util/threads.hpp>
|
||||||
#include <scwx/util/time.hpp>
|
#include <scwx/util/time.hpp>
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include <boost/range/irange.hpp>
|
#include <boost/range/irange.hpp>
|
||||||
#include <boost/timer/timer.hpp>
|
#include <boost/timer/timer.hpp>
|
||||||
|
|
||||||
|
|
@ -160,11 +163,13 @@ public:
|
||||||
|
|
||||||
float latitude_;
|
float latitude_;
|
||||||
float longitude_;
|
float longitude_;
|
||||||
float elevationCut_;
|
std::atomic<float> elevationCut_;
|
||||||
std::vector<float> elevationCuts_;
|
std::vector<float> elevationCuts_;
|
||||||
units::kilometers<float> range_;
|
units::kilometers<float> range_;
|
||||||
uint16_t vcp_;
|
uint16_t vcp_;
|
||||||
|
|
||||||
|
std::mutex elevationCutsMutex_ {};
|
||||||
|
|
||||||
std::chrono::system_clock::time_point sweepTime_;
|
std::chrono::system_clock::time_point sweepTime_;
|
||||||
|
|
||||||
std::shared_ptr<common::ColorTable> colorTable_;
|
std::shared_ptr<common::ColorTable> colorTable_;
|
||||||
|
|
@ -368,6 +373,7 @@ std::string Level2ProductView::GetRadarProductName() const
|
||||||
|
|
||||||
std::vector<float> Level2ProductView::GetElevationCuts() const
|
std::vector<float> Level2ProductView::GetElevationCuts() const
|
||||||
{
|
{
|
||||||
|
const std::unique_lock lock {p->elevationCutsMutex_};
|
||||||
return p->elevationCuts_;
|
return p->elevationCuts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -565,11 +571,17 @@ void Level2ProductView::ComputeSweep()
|
||||||
std::shared_ptr<wsr88d::rda::ElevationScan> radarData;
|
std::shared_ptr<wsr88d::rda::ElevationScan> radarData;
|
||||||
std::chrono::system_clock::time_point requestedTime {selected_time()};
|
std::chrono::system_clock::time_point requestedTime {selected_time()};
|
||||||
types::RadarProductLoadStatus loadStatus {};
|
types::RadarProductLoadStatus loadStatus {};
|
||||||
|
|
||||||
|
std::vector<float> newElevationCuts {};
|
||||||
std::tie(
|
std::tie(
|
||||||
radarData, p->elevationCut_, p->elevationCuts_, std::ignore, loadStatus) =
|
radarData, p->elevationCut_, newElevationCuts, std::ignore, loadStatus) =
|
||||||
radarProductManager->GetLevel2Data(
|
radarProductManager->GetLevel2Data(
|
||||||
p->dataBlockType_, p->selectedElevation_, requestedTime);
|
p->dataBlockType_, p->selectedElevation_, requestedTime);
|
||||||
|
|
||||||
|
std::unique_lock elevationCutsLock {p->elevationCutsMutex_};
|
||||||
|
p->elevationCuts_ = newElevationCuts;
|
||||||
|
elevationCutsLock.unlock();
|
||||||
|
|
||||||
set_load_status(loadStatus);
|
set_load_status(loadStatus);
|
||||||
|
|
||||||
if (radarData == nullptr)
|
if (radarData == nullptr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue