[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] audio: make audio poll timer deterministic
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] audio: make audio poll timer deterministic |
Date: |
Tue, 14 Feb 2017 12:57:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 13/02/2017 19:40, Yurii Zubrytskyi wrote:
> Hi,
>
> It looks to me that this behavior can be achieved with
> "timer_mod_anticipate()" function instead of a separate check.
True, but I think Pavel's version is more readable. Since the timer is
set to a fixed value from QEMU_CLOCK_VIRTUAL, timer_mod_anticipate is
never going to do anything if the timer is already set.
Paolo
> > diff --git a/audio/audio.c b/audio/audio.c
> > index c845a44..1ee95a5 100644
> > --- a/audio/audio.c
> > +++ b/audio/audio.c
> > @@ -1112,8 +1112,10 @@ static int audio_is_timer_needed (void)
> > static void audio_reset_timer (AudioState *s)
> > {
> > if (audio_is_timer_needed ()) {
> > - timer_mod (s->ts,
> > - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> conf.period.ticks);
> > + if (!timer_pending(s->ts)) {
> > + timer_mod (s->ts,
> > + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
> conf.period.ticks);
> > + }
> > }
> > else {
> > timer_del (s->ts);
>
>
>
>
>
>
> --
> Thanks, Yurii