|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH 1/7] Add support for generic notifier lists |
Date: | Mon, 15 Mar 2010 18:37:19 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0 |
On 03/15/2010 03:31 PM, Anthony Liguori wrote:
On 03/11/2010 08:19 AM, Paul Brook wrote:On 03/11/2010 06:57 AM, Paul Brook wrote:+struct QEMUNotifier +{ + void (*notify)(QEMUNotifier *notifier); +};I suggest combining this with QEMUBH.I take it your not opposed to converting QEMUBH to be a QEMUNotifier? If so, I'm happy to do it.It's unclear to me why you've invented a new thing in the first place.It's a better approximation of the command pattern because the command is a single object as opposed to a tuple. Because the command is an object, you can also do things like binding. For instance:
typedef struct IONotifier { Notifier parent; void (*notify)(IONotifier *notifier, int fd); int fd; } IONotifier; It's been a long day...
Which now gives you a notifier that has an fd bound to it's second argument (which is pretty useful for IO dispatch).You can do this with a tuple representation, but it gets awkward. One could argue for formalizing the tuple as a struct but extending by nesting becomes more complicated. Also, for the most part, you already have a state for the command and embedding the object means less dynamic memory allocation and less code to handle that.Regards, Anthony Liguori
Regards, Anthony Liguori
[Prev in Thread] | Current Thread | [Next in Thread] |