🐛 fix(async_executor): implement cooperative cancellation

This commit is contained in:
csh
2026-07-13 16:03:56 +08:00
parent edea37202d
commit 89b8937697
17 changed files with 685 additions and 420 deletions
@@ -49,7 +49,7 @@ namespace lsp::test::provider
struct ProviderEnv
{
scheduler::AsyncExecutor scheduler{ 1 };
scheduler::async_executor::AsyncExecutor scheduler{ 1 };
manager::ManagerHub hub{};
core::RequestDispatcher dispatcher{};
@@ -1225,7 +1225,7 @@ namespace lsp::test::provider
auto code_action_tree = env.hub.parser().GetTree(code_action_uri);
auto code_action_diagnostics = BuildDiagnosticsFromSyntaxErrors(code_action_tree, code_action_content);
env.scheduler.Submit("json_cancel_me", []() -> std::optional<std::string> {
env.scheduler.Submit("json_cancel_me", [](std::stop_token) -> std::optional<std::string> {
std::this_thread::sleep_for(std::chrono::milliseconds(200));
return std::string("done");
});