From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbpFL-0000pc-AJ for qemu-devel@nongnu.org; Tue, 05 Jun 2012 04:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbpFE-0000i9-Sj for qemu-devel@nongnu.org; Tue, 05 Jun 2012 04:36:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbpFE-0000hw-JI for qemu-devel@nongnu.org; Tue, 05 Jun 2012 04:36:04 -0400 Message-ID: <4FCDC4F0.6080901@redhat.com> Date: Tue, 05 Jun 2012 10:36:00 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1338875386-21051-1-git-send-email-yhalperi@redhat.com> <1338875386-21051-2-git-send-email-yhalperi@redhat.com> In-Reply-To: <1338875386-21051-2-git-send-email-yhalperi@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yonit Halperin Cc: aliguori@us.ibm.com, alevy@redhat.com, qemu-devel@nongnu.org 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