This commit is contained in:
2025-10-31 17:40:33 +03:00
parent d69ea51b0c
commit 8a202bd38c
6 changed files with 33 additions and 9 deletions

View File

@@ -521,12 +521,15 @@ public:
{
using intv_t = std::remove_cvref_t<decltype(_currentUpdateInterval)>;
_internalUpdatingStopSource = std::stop_source{}; // reset state
*_internalUpdating = true;
_internalUpdatingFuture = std::async(
std::launch::async,
[this](std::stop_token stop_token) -> error_t {
while (!stop_token.stop_requested()) {
// while (!stop_token.stop_requested()) {
while (true) {
_lastUpdateError = updateTelemetryData(defaultInternalUpdateTimeout);
if (_lastUpdateError) {
*_internalUpdating = false;
@@ -593,7 +596,9 @@ public:
*_isDataUpdated = false;
std::future<error_t> update_ft = std::async(std::launch::async, _updateFunc, stop_source.get_token());
// std::future<error_t> update_ft = std::async(std::launch::async, _updateFunc, stop_source.get_token());
std::future<error_t> update_ft =
std::async(std::launch::async, _updateFunc, _internalUpdatingStopSource.get_token());
auto status = update_ft.wait_for(timeout);
if (status == std::future_status::ready) {