qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 4/7] util: add qemu-co-timeout


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v2 4/7] util: add qemu-co-timeout
Date: Fri, 1 Apr 2022 17:23:28 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

01.04.2022 16:13, Hanna Reitz wrote:
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 <vsementsov@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).


Yes, the coroutine continue execution in parallel. That's a generic interface, and there 
is no way to "cancel" generic coroutine. So, caller should care about it.


--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]