qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter()


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter()
Date: Wed, 18 Feb 2015 13:50:51 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Feb 10, 2015 at 11:41:27AM +0100, Kevin Wolf wrote:
> qemu_coroutine_enter() is now the only user of coroutine_swap(). Both
> functions are short, so inline it.
> 
> Also, using COROUTINE_YIELD is now even more confusing because this code
> is never called during qemu_coroutine_yield() any more. In fact, this
> value is never read back, so we can just introduce a new COROUTINE_ENTER
> which documents the purpose of the task switch better.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  include/block/coroutine_int.h |  1 +
>  qemu-coroutine.c              | 36 +++++++++++++++---------------------
>  2 files changed, 16 insertions(+), 21 deletions(-)
> 
> diff --git a/include/block/coroutine_int.h b/include/block/coroutine_int.h
> index f133d65..69b83db 100644
> --- a/include/block/coroutine_int.h
> +++ b/include/block/coroutine_int.h
> @@ -29,6 +29,7 @@
>  #include "block/coroutine.h"
>  
>  typedef enum {
> +    COROUTINE_ENTER = 0,

This makes the ucontext code harder to understand because
CoroutineAction values are used with setjmp()/longjmp() in
qemu_coroutine_switch().

The longjmp() man page says:

  If longjmp() is invoked with a second argument of 0, 1 will be
  returned instead.

I haven't checked whether or not this causes problems, but the code
would be simpler if we avoided using 0.

Attachment: pgpaazs6GHwco.pgp
Description: PGP signature


reply via email to

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