Use dedicated thread pool for radar product views

This commit is contained in:
Dan Paulat 2023-05-28 13:05:28 -05:00
parent 608ee904b8
commit 1c159a3926
6 changed files with 9 additions and 14 deletions

View file

@ -290,11 +290,6 @@ void Level2ProductViewImpl::SetProduct(common::Level2Product product)
}
}
void Level2ProductView::Update()
{
util::async([this]() { ComputeSweep(); });
}
void Level2ProductView::UpdateColorTable()
{
if (p->momentDataBlock0_ == nullptr || //

View file

@ -39,7 +39,6 @@ public:
void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) override;
void SelectElevation(float elevation) override;
void SelectProduct(const std::string& productName) override;
void Update() override;
common::RadarProductGroup GetRadarProductGroup() const override;
std::string GetRadarProductName() const override;

View file

@ -1,7 +1,6 @@
#include <scwx/qt/view/level3_product_view.hpp>
#include <scwx/common/constants.hpp>
#include <scwx/util/logger.hpp>
#include <scwx/util/threads.hpp>
#include <scwx/util/time.hpp>
#include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp>
#include <scwx/wsr88d/rpg/graphic_product_message.hpp>
@ -161,11 +160,6 @@ void Level3ProductView::LoadColorTable(
UpdateColorTable();
}
void Level3ProductView::Update()
{
util::async([this]() { ComputeSweep(); });
}
void Level3ProductView::UpdateColorTable()
{
logger_->debug("UpdateColorTable()");

View file

@ -32,7 +32,6 @@ public:
std::uint16_t color_table_max() const override;
void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) override;
void Update() override;
common::RadarProductGroup GetRadarProductGroup() const override;
std::string GetRadarProductName() const override;

View file

@ -2,6 +2,7 @@
#include <scwx/common/constants.hpp>
#include <scwx/util/logger.hpp>
#include <boost/asio.hpp>
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
@ -36,6 +37,8 @@ public:
}
~RadarProductViewImpl() = default;
boost::asio::thread_pool threadPool_ {1};
bool initialized_;
std::mutex sweepMutex_;
@ -118,6 +121,11 @@ void RadarProductView::SelectTime(std::chrono::system_clock::time_point time)
p->selectedTime_ = time;
}
void RadarProductView::Update()
{
boost::asio::post(p->threadPool_, [this]() { ComputeSweep(); });
}
bool RadarProductView::IsInitialized() const
{
return p->initialized_;

View file

@ -51,7 +51,7 @@ public:
virtual void SelectElevation(float elevation);
virtual void SelectProduct(const std::string& productName) = 0;
void SelectTime(std::chrono::system_clock::time_point time);
virtual void Update() = 0;
void Update();
bool IsInitialized() const;