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: Hanna Reitz
Subject: Re: [PATCH v2 4/7] util: add qemu-co-timeout
Date: Fri, 1 Apr 2022 15:13:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

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).




reply via email to

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