From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrGxz-0004WM-93 for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:32:47 -0400 Received: from [199.232.76.173] (port=53535 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrGxy-0004W7-RP for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:32:46 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrGxx-0008PA-NV for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:32:46 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:55963) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NrGxu-0008NW-H6 for qemu-devel@nongnu.org; Mon, 15 Mar 2010 16:32:45 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e31.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2FKND6U016333 for ; Mon, 15 Mar 2010 14:23:13 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2FKVvPq086934 for ; Mon, 15 Mar 2010 14:32:07 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2FDVr5l010653 for ; Mon, 15 Mar 2010 07:31:53 -0600 Message-ID: <4B9E9937.3090501@linux.vnet.ibm.com> Date: Mon, 15 Mar 2010 15:31:51 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/7] Add support for generic notifier lists References: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> <201003111257.59828.paul@codesourcery.com> <4B98F99F.1000506@codemonkey.ws> <201003111419.53494.paul@codesourcery.com> In-Reply-To: <201003111419.53494.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: Luiz Capitulino , qemu-devel@nongnu.org, Gerd Hoffman 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: 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