Received: from eggs.gnu.org ([2001:4830:134:3::10]:60100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9bxA-0001gL-RN for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:21:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9bx2-0005Jm-DQ for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:21:36 -0400 Received: from mail-ee0-x234.google.com ([2a00:1450:4013:c00::234]:54015) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9bx2-0005Je-6x for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:21:28 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so4974702eek.11 for ; Wed, 14 Aug 2013 07:21:27 -0700 (PDT) Date: Wed, 14 Aug 2013 16:21:24 +0200 From: Stefan Hajnoczi Message-ID: <20130814142124.GB28912@stefanha-thinkpad.redhat.com> References: <1376070245-22557-1-git-send-email-charlie@ctshepherd.com> <1376070245-22557-2-git-send-email-charlie@ctshepherd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1376070245-22557-2-git-send-email-charlie@ctshepherd.com> Subject: Re: [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Charlie Shepherd Cc: kwolf@redhat.com, pbonzini@redhat.com, gabriel@kerneis.info, qemu-devel@nongnu.org On Fri, Aug 09, 2013 at 07:43:52PM +0200, Charlie Shepherd wrote: > @@ -133,3 +133,8 @@ void coroutine_fn qemu_coroutine_yield(void) > self->caller = NULL; > coroutine_swap(self, to); > } > + > +coroutine_fn Coroutine *qemu_coroutine_self(void) > +{ > + return qemu_coroutine_self_int(); > +} The example in include/block/coroutine.h says: * For example: * * static void coroutine_fn foo(void) { * .... * } Not sure how happy compilers are with __attribute__ before the return type, but I suggest consistently placing coroutine_fn after the return type. Also, a comment would be helpful here to explain the need for the external/internal functions. Otherwise the next person might undo this again thinking it pointless :). coroutine_fn Coroutine *qemu_coroutine_self(void) { /* Call the internal version of this function, which is * non-coroutine_fn and can therefore be called from from * non-coroutine contexts. Internally we know it's always possible * to pull a Coroutine* out of thin air (or thread-local storage). * External callers shouldn't assume they can always get a * Coroutine* since we may not be in coroutine context, hence the * external version of this function. */ return qemu_coroutine_self_int(); }