From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "amit.shah" <amit.shah@redhat.com>,
lersek@redhat.com, QEMU <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/3] monitor: remove old entries from event hash table
Date: Thu, 17 Sep 2015 16:43:25 +0200 [thread overview]
Message-ID: <CAJ+F1CL8bpJUV+DTHPZxAx_-_UzctwyaBQio+E7nPHVi+spFHw@mail.gmail.com> (raw)
In-Reply-To: <87mvwmjokc.fsf@blackfin.pond.sub.org>
On Wed, Sep 16, 2015 at 6:50 PM, Markus Armbruster <armbru@redhat.com> 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
next prev parent reply other threads:[~2015-09-17 14:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 11:09 [Qemu-devel] [PATCH 0/3] monitor: throttle VSERPORT_CHANGED by "id" marcandre.lureau
2015-09-02 11:09 ` [Qemu-devel] [PATCH 1/3] monitor: split MonitorQAPIEventState marcandre.lureau
2015-09-10 8:34 ` Daniel P. Berrange
2015-09-16 13:57 ` Markus Armbruster
2015-09-17 13:17 ` Marc-André Lureau
2015-09-02 11:09 ` [Qemu-devel] [PATCH 2/3] monitor: throttle QAPI_EVENT_VSERPORT_CHANGE by "id" marcandre.lureau
2015-09-10 8:35 ` Daniel P. Berrange
2015-09-16 16:40 ` Markus Armbruster
2015-09-17 11:28 ` Marc-André Lureau
2015-09-17 14:06 ` Marc-André Lureau
2015-09-02 11:09 ` [Qemu-devel] [PATCH 3/3] monitor: remove old entries from event hash table marcandre.lureau
2015-09-10 8:35 ` Daniel P. Berrange
2015-09-16 16:50 ` Markus Armbruster
2015-09-17 14:43 ` Marc-André Lureau [this message]
2015-09-08 10:18 ` [Qemu-devel] [PATCH 0/3] monitor: throttle VSERPORT_CHANGED by "id" Marc-André Lureau
2015-09-10 4:22 ` Amit Shah
2015-09-10 6:46 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ+F1CL8bpJUV+DTHPZxAx_-_UzctwyaBQio+E7nPHVi+spFHw@mail.gmail.com \
--to=marcandre.lureau@gmail.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).