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 <kw...@redhat.com> > --- > 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 <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature