From 8d813848f07499c94c4fcd5425a319295fa0c878 Mon Sep 17 00:00:00 2001 From: qiuyi21 Date: Sat, 19 Jul 2025 16:27:58 +0800 Subject: [PATCH] fix the issue where co::event cannot be woken up when a different coroutine's wait times out Signed-off-by: qiuyi21 --- src/co/co.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/co/co.cc b/src/co/co.cc index 08aad350..56b6cd31 100644 --- a/src/co/co.cc +++ b/src/co/co.cc @@ -321,7 +321,12 @@ bool event_impl::wait(uint32 ms) { _wc.pop_front(); !x ? (void)(x = w) : co::free(w, sizeof(*w)); } - x ? (void)(x->state = st_wait) : (void)(x = make_waitx(co)); + if (x) { + x->co = co; + x->state = st_wait; + } else { + x = make_waitx(co); + } co->waitx = x; _wc.push_back(x); }