qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns
Date: Tue, 08 Oct 2013 11:25:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 08/10/2013 11:15, Alex Bligh ha scritto:
> So "if we want to alter it" ...
> 
>> > +        if (ts->expire_time != -1) {
>> > +            timer_del_locked(timer_list, ts);
>> > +        }
> What's this bit for? Surely you've calculated whether you are
> shortening the expiry time (above), so all you need do now is
> modify it. Why delete it? timer_mod_ns doesn't make this
> check?

timer_mod_ns_locked does not remove the timer from the list:

    qemu_mutex_lock(&timer_list->active_timers_lock);
    timer_del_locked(timer_list, ts);
    rearm = timer_mod_ns_locked(timer_list, ts, expire_time);
    qemu_mutex_unlock(&timer_list->active_timers_lock);

This is doing the same.  The check in the "if" is not strictly
necessary, but it saves a useless visit of the list.  It could be added
to timer_mod_ns as well.

Paolo



reply via email to

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