Avoid uncommon race condition with computing a sweep during radar product view destruction

This commit is contained in:
Dan Paulat 2023-11-05 07:52:27 -06:00
parent f56d7f14bf
commit bb2d3a92ad
8 changed files with 37 additions and 7 deletions

View file

@ -41,13 +41,15 @@ public:
{
coordinates_.resize(kMaxCoordinates_);
}
~Level3RadialViewImpl() = default;
~Level3RadialViewImpl() { threadPool_.join(); };
void ComputeCoordinates(
std::shared_ptr<wsr88d::rpg::GenericRadialDataPacket> radialData);
Level3RadialView* self_;
boost::asio::thread_pool threadPool_ {1u};
std::vector<float> coordinates_ {};
std::vector<float> vertices_ {};
std::vector<std::uint8_t> dataMoments8_ {};
@ -73,6 +75,11 @@ Level3RadialView::~Level3RadialView()
std::unique_lock sweepLock {sweep_mutex()};
}
boost::asio::thread_pool& Level3RadialView::thread_pool()
{
return p->threadPool_;
}
float Level3RadialView::range() const
{
return p->range_;