[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifi
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers |
Date: |
Tue, 05 Jun 2012 10:36:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120422 Thunderbird/10.0.4 |
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
- [Qemu-devel] [RFC PATCH 0/5] asynchronous migration state change handlers, Yonit Halperin, 2012/06/05
- [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers, Yonit Halperin, 2012/06/05
- Re: [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers,
Gerd Hoffmann <=
- [Qemu-devel] [RFC PATCH 2/5] migration: moving migration start code to a separated routine, Yonit Halperin, 2012/06/05
- [Qemu-devel] [RFC PATCH 3/5] migration: moving migration completion code to a separated routine, Yonit Halperin, 2012/06/05
- [Qemu-devel] [RFC PATCH 5/5] spice: turn spice "migration end" handler to be async, Yonit Halperin, 2012/06/05
- [Qemu-devel] [RFC PATCH 4/5] migration: replace migration state change notifier with async notifiers, Yonit Halperin, 2012/06/05
- Re: [Qemu-devel] [RFC PATCH 0/5] asynchronous migration state change handlers, Anthony Liguori, 2012/06/05