微调
This commit is contained in:
@@ -39,7 +39,33 @@ ucoro::awaitable<void> data_feed_thread_coro(std::atomic<bool>& running) {
|
||||
for (auto& source : mode_acs.data_source_config.map.list()) {
|
||||
if (!source->enable) continue;
|
||||
if (!source->is_open() && !source->open()) continue;
|
||||
co_await source->source_step_coro();
|
||||
|
||||
|
||||
co_await source->handle_in_loop_coro();
|
||||
auto mode_data = co_await source->read_coro();
|
||||
|
||||
struct Process_Result {
|
||||
std::exception_ptr exception;
|
||||
};
|
||||
|
||||
auto result = co_await ucoro::callback_awaitable<Process_Result>(
|
||||
[source, mode_data = std::move(mode_data)](auto done) mutable {
|
||||
asio::post(
|
||||
data_source_process_pool(),
|
||||
[source, mode_data = std::move(mode_data), done = std::move(done)]() mutable {
|
||||
try {
|
||||
source->process_mode_acs_data(mode_data);
|
||||
done(Process_Result{});
|
||||
} catch (...) {
|
||||
done(Process_Result{std::current_exception()});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (result.exception) {
|
||||
std::rethrow_exception(result.exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 这两个每次循环都要重新计算 保证实时性
|
||||
|
||||
Reference in New Issue
Block a user