...
This commit is contained in:
@@ -598,15 +598,20 @@ 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, _internalUpdatingStopSource.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) {
|
||||
*_isDataUpdated = true;
|
||||
_lastUpdateError = update_ft.get();
|
||||
} else {
|
||||
} else if (status == std::future_status::deferred) { // std::async was invoked in this thread, get result
|
||||
_lastUpdateError = update_ft.get();
|
||||
if (!_lastUpdateError) {
|
||||
*_isDataUpdated = true;
|
||||
}
|
||||
} else { // timeout
|
||||
stop_source.request_stop();
|
||||
_lastUpdateError = MccTelemetryErrorCode::ERROR_DATA_TIMEOUT;
|
||||
}
|
||||
@@ -631,7 +636,7 @@ public:
|
||||
return MccTelemetryErrorCode::ERROR_DATA_TIMEOUT;
|
||||
}
|
||||
|
||||
std::lock_guard thread_lock{*_updateMutex};
|
||||
// std::lock_guard thread_lock{*_updateMutex};
|
||||
|
||||
if (!_lastUpdateError) {
|
||||
mcc_copy_telemetry_data(_data, tdata);
|
||||
|
||||
Reference in New Issue
Block a user