qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_coroutine_enter_if_inactive()
Date: Thu, 10 Nov 2016 17:49:32 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 11/10/2016 11:19 AM, Kevin Wolf wrote:
> In the context of asynchronous work, if we have a worker coroutine that
> didn't yield, the parent coroutine cannot be reentered because it hasn't
> yielded yet. In this case we don't even have to reenter the parent
> because it will see that the work is already done and won't even yield.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  include/qemu/coroutine.h | 6 ++++++
>  util/qemu-coroutine.c    | 8 ++++++++
>  2 files changed, 14 insertions(+)
> 

> +++ b/util/qemu-coroutine.c
> @@ -19,6 +19,7 @@
>  #include "qemu/atomic.h"
>  #include "qemu/coroutine.h"
>  #include "qemu/coroutine_int.h"
> +#include "block/aio.h"

Why do you need this include?

>  
>  enum {
>      POOL_BATCH_SIZE = 64,
> @@ -131,6 +132,13 @@ void qemu_coroutine_enter(Coroutine *co)
>      }
>  }
>  
> +void qemu_coroutine_enter_if_inactive(Coroutine *co)
> +{
> +    if (!qemu_coroutine_entered(co)) {
> +        qemu_coroutine_enter(co);
> +    }
> +}
> +
>  void coroutine_fn qemu_coroutine_yield(void)
>  {
>      Coroutine *self = qemu_coroutine_self();
> 

Otherwise:
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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