Add tests for saved_handler cancellation_slot::emplace exception safety#3075
Add tests for saved_handler cancellation_slot::emplace exception safety#3075ssam18 wants to merge 0 commit intoboostorg:developfrom
Conversation
|
The fix (also?) doesn't look accurate to me. In particular, you applied it to the branch where the documentation claims the immediate executor should be used, however, your bind overrides it with any associated non-immediate executor. Note that Assuming that you ran into this as a problem in your code, can you share a minimal example where the wrong executor is used? Then we can understand what actually needs to be fixed. I can see two potential causes here:
That is, assuming you have demonstrated a case where the wrong executor is effectively used. |
|
I believe this is related to the issue briefly described in #3047. Asio recommends using asio::async_immediate(self.get_io_executor(), std::move(self));Internally, this leads to a call to template <typename CompletionHandler>
void operator()(CompletionHandler&& handler) const
{
typename associated_immediate_executor<
CompletionHandler, executor_type>::type ex =
(get_associated_immediate_executor)(handler, ex_);
(dispatch)(ex, static_cast<CompletionHandler&&>(handler));
}If the handler has an associated executor, In this context, the handler is the composed operation object ( Our current implementation behaves slightly differently. Instead of passing the composed operation object to auto const ex = this->get_immediate_executor();
net::dispatch(
ex,
net::append(std::move(h_), std::forward<Args>(args)...));Because of this,
|
478fea8 to
67106eb
Compare
Adds a test case to verify that
saved_handler::emplacecorrectly cleans up whencancellation_slot::emplacethrows an exception — specifically that the handler has no value after the throw.This tests the behavior introduced in: