On 01.04.22 11:19, Vladimir Sementsov-Ogievskiy wrote:
Add new API, to make a time limited call of the coroutine.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@openvz.org>
---
include/qemu/coroutine.h | 13 ++++++
util/meson.build | 1 +
util/qemu-co-timeout.c | 89 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+)
create mode 100644 util/qemu-co-timeout.c
I don’t really understand what this does. Intuitively, I would have
assumed this makes the first yield of the respective coroutine not
return when the timeout has elapsed, and instead, we switch back to
qemu_co_timeout(), which returns to its callers.
But it looks like when this yield happens and we switch back to
qemu_co_timeout(), the coroutine actually isn’t cancelled, and will just
continue running, actually. Is that right? On first look, this looks
like it’ll be quite difficult to think about what happens when this is
used, because the coroutine in question is no longer run in sequence
with its caller, but actually might run in parallel (even though it’s
still a coroutine, so it’ll remain cooperative multitasking).