qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] main-loop: Calculate poll timeout using timeout


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] main-loop: Calculate poll timeout using timeout argument
Date: Mon, 30 Apr 2012 21:53:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120425 Thunderbird/12.0

Il 29/04/2012 19:15, Stefan Weil ha scritto:
> The timeout argument was unused up to now,
> but it can be used to reduce the poll_timeout when it is infinite
> (negative value) or larger than timeout.
> 
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>  main-loop.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/main-loop.c b/main-loop.c
> index 24cf540..eb3b6e6 100644
> --- a/main-loop.c
> +++ b/main-loop.c
> @@ -425,7 +425,7 @@ static int os_host_main_loop_wait(uint32_t timeout)
>      if (nfds >= 0) {
>          ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0);
>          if (ret != 0) {
> -            /* TODO. */
> +            timeout = 0;
>          }
>      }
>  
> @@ -439,6 +439,10 @@ static int os_host_main_loop_wait(uint32_t timeout)
>          poll_fds[n_poll_fds + i].events = G_IO_IN;
>      }
>  
> +    if (poll_timeout < 0 || timeout < poll_timeout) {
> +        poll_timeout = timeout;
> +    }
> +
>      qemu_mutex_unlock_iothread();
>      ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout);
>      qemu_mutex_lock_iothread();

Reviewed-by: Paolo Bonzini <address@hidden>



reply via email to

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