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: Alex Bligh
Subject: Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns
Date: Tue, 8 Oct 2013 18:01:02 +0100

On 8 Oct 2013, at 10:25, Paolo Bonzini wrote:

> 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.

Quite right. I'd missed the timer_del somehow.

-- 
Alex Bligh







reply via email to

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