From cf6f0e529be51591b8cfe3b2368dcc4cfc505383 Mon Sep 17 00:00:00 2001 From: Klemens Morgenstern Date: Mon, 21 Oct 2024 07:04:54 +0800 Subject: [PATCH] fixes #206 --- include/boost/cobalt/channel.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/boost/cobalt/channel.hpp b/include/boost/cobalt/channel.hpp index 98e71176..e59c6dc9 100644 --- a/include/boost/cobalt/channel.hpp +++ b/include/boost/cobalt/channel.hpp @@ -85,6 +85,13 @@ struct channel this->unlink(); } + void interrupt_await() + { + this->cancelled = true; + if (awaited_from) + awaited_from.release().resume(); + } + struct cancel_impl; bool await_ready() { return !chn->buffer_.empty(); } template @@ -118,6 +125,13 @@ struct channel this->unlink(); } + void interrupt_await() + { + this->cancelled = true; + if (awaited_from) + awaited_from.release().resume(); + } + struct cancel_impl; bool await_ready() { return !chn->buffer_.full(); } @@ -234,6 +248,13 @@ struct channel this->unlink(); } + void interrupt_await() + { + this->cancelled = true; + if (awaited_from) + awaited_from.release().resume(); + } + struct cancel_impl; bool await_ready() { return (chn->n_ > 0); } template @@ -261,6 +282,13 @@ struct channel this->unlink(); } + void interrupt_await() + { + this->cancelled = true; + if (awaited_from) + awaited_from.release().resume(); + } + struct cancel_impl; bool await_ready() {