qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Yonit Halperin <yhalperi@redhat.com>
Cc: aliguori@us.ibm.com, alevy@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers
Date: Tue, 05 Jun 2012 10:36:00 +0200	[thread overview]
Message-ID: <4FCDC4F0.6080901@redhat.com> (raw)
In-Reply-To: <1338875386-21051-2-git-send-email-yhalperi@redhat.com>

  Hi,

> +static void notified_complete_cb(AsyncNotifier *notifier, void *opaque)
> +{

There is no need to implement this as callback (unlike the notifier
_list_ completion callback).  Just have a public notifier_complete()
function which async notifiers are supposed to call when done.

>  void notifier_list_notify(NotifierList *list, void *data)
>  {
> -    Notifier *notifier, *next;
> +    BaseNotifier *notifier, *next;
> +    bool async = false;
> +
> +    if (notifier_list_async_waiting(list)) {

assert(!notifier_list_async_waiting(list)) ?

Silently removing entries from the wait_notifier list here is asking for
trouble.  We should have a notifier_list_cancel() function instead which
also calls Notifier->cancel() for all pending async notifiers
(implementing that can wait until we have an actual need for it).

> +struct BaseNotifier {

>  struct Notifier
>  {
> +    BaseNotifier base;
>      void (*notify)(Notifier *notifier, void *data);

> +struct AsyncNotifier {
> +    BaseNotifier base;
> +    void (*notify_async)(AsyncNotifier *notifier, void *data,
> +                         NotifiedCompletionFunc *complete_cb, void *cb_data);

I don't see a need for three types here, especially as there will be no
difference between notify() and notify_async() prototypes once the
notifier completion callback is gone.  I'd suggest to just extent Notifier.

cheers,
  Gerd

  reply	other threads:[~2012-06-05  8:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05  5:49 [Qemu-devel] [RFC PATCH 0/5] asynchronous migration state change handlers Yonit Halperin
2012-06-05  5:49 ` [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers Yonit Halperin
2012-06-05  8:36   ` Gerd Hoffmann [this message]
2012-06-05  5:49 ` [Qemu-devel] [RFC PATCH 2/5] migration: moving migration start code to a separated routine Yonit Halperin
2012-06-05  8:44   ` Gerd Hoffmann
2012-06-05  5:49 ` [Qemu-devel] [RFC PATCH 3/5] migration: moving migration completion " Yonit Halperin
2012-06-05  8:46   ` Gerd Hoffmann
2012-06-05  5:49 ` [Qemu-devel] [RFC PATCH 4/5] migration: replace migration state change notifier with async notifiers Yonit Halperin
2012-06-05  5:49 ` [Qemu-devel] [RFC PATCH 5/5] spice: turn spice "migration end" handler to be async Yonit Halperin
2012-06-05 11:59 ` [Qemu-devel] [RFC PATCH 0/5] asynchronous migration state change handlers Anthony Liguori
2012-06-05 13:15   ` Gerd Hoffmann
2012-06-05 13:38     ` Eric Blake
2012-06-05 21:37       ` Anthony Liguori
2012-06-06  9:10     ` Yonit Halperin
2012-06-06  9:22       ` Anthony Liguori
2012-06-06 10:54         ` Alon Levy
2012-06-06 11:05           ` Anthony Liguori
2012-06-06 11:27             ` Alon Levy
2012-06-06 11:49               ` Anthony Liguori
2012-06-06 12:01         ` Yonit Halperin
2012-06-06 12:08           ` Anthony Liguori
2012-06-06 12:15             ` Alon Levy
2012-06-06 12:17               ` Anthony Liguori
2012-06-06 12:30                 ` Alon Levy
2012-06-06 12:34                   ` Anthony Liguori
2012-06-06 13:03                   ` Gerd Hoffmann
2012-06-06 14:52                     ` Alon Levy
2012-06-06 15:00                       ` Gerd Hoffmann

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=4FCDC4F0.6080901@redhat.com \
    --to=kraxel@redhat.com \
    --cc=alevy@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yhalperi@redhat.com \
    /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).