2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-26 18:22:09 +00:00

Dispatch cancellation handlers on the correct executor.

When a completion handler for spawn() or co_spawn() uses a specified
(i.e. non-default) associated executor, cancellation handlers need to
be dispatched to the executor that was passed to spawn() or co_spawn().
This commit is contained in:
Christopher Kohlhoff
2022-12-07 07:33:39 +11:00
parent ce07af1fdf
commit 61796a5704
2 changed files with 6 additions and 6 deletions

View File

@@ -204,8 +204,8 @@ template <typename Handler, typename Executor, typename = void>
class co_spawn_cancellation_handler
{
public:
co_spawn_cancellation_handler(const Handler& handler, const Executor& ex)
: ex_(boost::asio::get_associated_executor(handler, ex))
co_spawn_cancellation_handler(const Handler&, const Executor& ex)
: ex_(ex)
{
}
@@ -222,7 +222,7 @@ public:
private:
cancellation_signal signal_;
typename associated_executor<Handler, Executor>::type ex_;
Executor ex_;
};

View File

@@ -1113,8 +1113,8 @@ template <typename Handler, typename Executor, typename = void>
class spawn_cancellation_handler
{
public:
spawn_cancellation_handler(const Handler& handler, const Executor& ex)
: ex_(boost::asio::get_associated_executor(handler, ex))
spawn_cancellation_handler(const Handler&, const Executor& ex)
: ex_(ex)
{
}
@@ -1131,7 +1131,7 @@ public:
private:
cancellation_signal signal_;
typename associated_executor<Handler, Executor>::type ex_;
Executor ex_;
};