From 96a2143dea30dace0783758b0ce62f0feffbed19 Mon Sep 17 00:00:00 2001 From: Serein <2075337935@qq.com> Date: Sun, 11 Aug 2024 08:34:41 +0800 Subject: [PATCH] fix(executor): function cannot be called --- src/Controller/AsyncExecutor.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Controller/AsyncExecutor.hh b/src/Controller/AsyncExecutor.hh index a8622654..5ccc77b8 100644 --- a/src/Controller/AsyncExecutor.hh +++ b/src/Controller/AsyncExecutor.hh @@ -26,7 +26,7 @@ using Task = net::awaitable; class AsyncExecutor { public: AsyncExecutor(const AsyncExecutor&) = delete; - AsyncExecutor& operator==(const AsyncExecutor&) = delete; + AsyncExecutor& operator=(const AsyncExecutor&) = delete; /** * @param task: return value of a coroutine, @@ -95,6 +95,7 @@ public: BOOST_ASIO_COMPLETION_TOKEN_FOR( typename net::detail::awaitable_signature>::type) CompletionCallback> + requires std::is_invocable_v void asyncExecute(TaskFunc&& func, CompletionCallback&& callback, std::chrono::steady_clock::duration interval) { @@ -149,7 +150,9 @@ private: callback = std::forward(callback), this](const boost::system::error_code& ec) { if (!ec) { - net::co_spawn(_ioc, func, [callback]() { slint::invoke_from_event_loop(callback); }); + net::co_spawn(_ioc, func(), [callback]() { + slint::invoke_from_event_loop(callback); + }); asyncExecuteByTimerHelper(std::move(func), std::move(callback), taskId); } else { spdlog::error(ec.what());