🐛 fix(async_executor): implement cooperative cancellation
This commit is contained in:
@@ -64,7 +64,7 @@ namespace lsp::test::provider
|
||||
{
|
||||
struct ProviderEnv
|
||||
{
|
||||
scheduler::AsyncExecutor scheduler{ 1 };
|
||||
scheduler::async_executor::AsyncExecutor scheduler{ 1 };
|
||||
manager::ManagerHub hub{};
|
||||
core::ExecutionContext context;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace lsp::test::provider
|
||||
{
|
||||
struct ProviderEnv
|
||||
{
|
||||
scheduler::AsyncExecutor scheduler{ 1 };
|
||||
scheduler::async_executor::AsyncExecutor scheduler{ 1 };
|
||||
manager::ManagerHub hub{};
|
||||
core::ExecutionContext context;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace lsp::test::provider
|
||||
|
||||
struct ProviderEnv
|
||||
{
|
||||
scheduler::AsyncExecutor scheduler{ 4 };
|
||||
scheduler::async_executor::AsyncExecutor scheduler{ 4 };
|
||||
manager::ManagerHub hub{};
|
||||
core::ExecutionContext context;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace lsp::test::provider
|
||||
{
|
||||
struct ProviderEnv
|
||||
{
|
||||
scheduler::AsyncExecutor scheduler{ 1 };
|
||||
scheduler::async_executor::AsyncExecutor scheduler{ 1 };
|
||||
manager::ManagerHub hub{};
|
||||
core::ExecutionContext context;
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace lsp::test::provider
|
||||
struct ProviderEnv
|
||||
{
|
||||
std::vector<core::ServerLifecycleEvent> events;
|
||||
scheduler::AsyncExecutor scheduler{ 1 };
|
||||
scheduler::async_executor::AsyncExecutor scheduler{ 1 };
|
||||
manager::ManagerHub hub{};
|
||||
core::ExecutionContext context;
|
||||
|
||||
@@ -3426,7 +3426,7 @@ namespace lsp::test::provider
|
||||
ProviderEnv env;
|
||||
|
||||
std::atomic<bool> started{ false };
|
||||
env.scheduler.Submit("cancel_me", [&started]() -> std::optional<std::string> {
|
||||
env.scheduler.Submit("cancel_me", [&started](std::stop_token) -> std::optional<std::string> {
|
||||
started.store(true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
return std::string("done");
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace lsp::test::provider
|
||||
|
||||
struct ProviderEnv
|
||||
{
|
||||
scheduler::AsyncExecutor scheduler{ 1 };
|
||||
scheduler::async_executor::AsyncExecutor scheduler{ 1 };
|
||||
manager::ManagerHub hub{};
|
||||
core::ExecutionContext context;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user