Skip to content

Commit a1ebf51

Browse files
committed
remove useless dispatch
1 parent bb1564e commit a1ebf51

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

include/ylt/coro_io/coro_io.hpp

+8-11
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,16 @@ inline async_simple::coro::Lazy<ret_type> async_io(IO_func io_func,
230230
auto lock = lock_ref;
231231
hasCanceled = !slot->emplace(
232232
async_simple::SignalType::Terminate,
233-
[&obj, weak_lock = std::weak_ptr{lock}, executor = executor](
233+
[&obj, weak_lock = std::weak_ptr{lock}](
234234
async_simple::SignalType signalType,
235235
async_simple::Signal *signal) {
236-
asio::dispatch(
237-
executor, [&obj, weak_lock = std::move(weak_lock)]() {
238-
if (auto ptr = weak_lock.lock(); ptr) {
239-
bool expected = false;
240-
if (!ptr->compare_exchange_strong(
241-
expected, true, std::memory_order_release)) {
242-
detail::cancel(obj);
243-
}
244-
}
245-
});
236+
if (auto ptr = weak_lock.lock(); ptr) {
237+
bool expected = false;
238+
if (!ptr->compare_exchange_strong(
239+
expected, true, std::memory_order_release)) {
240+
detail::cancel(obj);
241+
}
242+
}
246243
});
247244
if (hasCanceled) {
248245
asio::dispatch(executor, [handler]() {

0 commit comments

Comments
 (0)