[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] monitor: remove old entries from event hash
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] monitor: remove old entries from event hash table |
Date: |
Thu, 17 Sep 2015 16:43:25 +0200 |
On Wed, Sep 16, 2015 at 6:50 PM, Markus Armbruster <address@hidden> wrote:
> I doubt you're supposed to poke into p->timer like that.
>
I don't think that matters, much (it could have a helper perhaps), anyway:
>> + timer_mod_ns(p->timer, then);
>> +}
>> +
>> +static void monitor_qapi_event_id_handler(void *opaque)
>> +{
>> + MonitorQAPIEventPending *p = opaque;
>> +
>> + monitor_qapi_event_handler(p);
>> + monitor_qapi_event_id_schedule_remove(p);
>> +}
>> +
>> static bool
>> monitor_qapi_event_id_delay(MonitorQAPIEventState *evstate, QDict *data)
>> {
>> @@ -554,7 +593,13 @@ monitor_qapi_event_id_delay(MonitorQAPIEventState
>> *evstate, QDict *data)
>> g_hash_table_insert(ht, g_strdup(id), p);
>> }
>>
>> - return monitor_qapi_event_pending_update(evstate, p, data);
>> + if (monitor_qapi_event_pending_update(evstate, p, data)) {
>> + p->timer->cb = monitor_qapi_event_id_handler;
>> + return true;
>> + } else {
>> + monitor_qapi_event_id_schedule_remove(p);
>> + return false;
>> + }
>> }
>>
>> /*
>
> Possibly cleaner than messing with timer->cb: have a single callback
> that does the right thing, i.e. when the timer goes off, check whether
> we have an event. If yes, send it and rearm the timer. If no, remove
> the hash entry.
ok, I'll have a single handler instead
--
Marc-André Lureau
- Re: [Qemu-devel] [PATCH 1/3] monitor: split MonitorQAPIEventState, (continued)