From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6cnZ-0004Xx-Kz for qemu-devel@nongnu.org; Tue, 06 Aug 2013 04:39:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6cnU-0008Ei-Ki for qemu-devel@nongnu.org; Tue, 06 Aug 2013 04:39:21 -0400 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:59891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6cnU-0008DU-Ea for qemu-devel@nongnu.org; Tue, 06 Aug 2013 04:39:16 -0400 Received: by mail-wi0-f175.google.com with SMTP id hq12so2383626wib.8 for ; Tue, 06 Aug 2013 01:39:15 -0700 (PDT) Date: Tue, 6 Aug 2013 10:39:12 +0200 From: Stefan Hajnoczi Message-ID: <20130806083912.GC32024@stefanha-thinkpad.redhat.com> References: <1375728247-1306-1-git-send-email-charlie@ctshepherd.com> <1375728247-1306-2-git-send-email-charlie@ctshepherd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1375728247-1306-2-git-send-email-charlie@ctshepherd.com> Subject: Re: [Qemu-devel] [PATCH 1/5] Add an explanation of when a function should be marked coroutine_fn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Charlie Shepherd Cc: kwolf@redhat.com, pbonzini@redhat.com, Charlie Shepherd , gabriel@kerneis.info, qemu-devel@nongnu.org On Mon, Aug 05, 2013 at 08:44:03PM +0200, Charlie Shepherd wrote: > From: Charlie Shepherd > > Coroutine functions that can yield directly or indirectly should be annotated > with a coroutine_fn annotation. Add an explanation to that effect in > include/block/coroutine.h. > --- > include/block/coroutine.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/block/coroutine.h b/include/block/coroutine.h > index 377805a..3b94b6d 100644 > --- a/include/block/coroutine.h > +++ b/include/block/coroutine.h > @@ -37,6 +37,9 @@ > * static checker support for catching such errors. This annotation might make > * it possible and in the meantime it serves as documentation. > * > + * A function must be marked with coroutine_fn if it can yield execution, either > + * directly or indirectly. > + * This is correct except for the case of dynamic functions that do: if (qemu_in_coroutine()) { } else { Coroutine *co = qemu_coroutine_new(...); ... } Here the function is coroutine_fn only if the caller is in coroutine context. I think your comment update should include a note about this. When you've split all dynamic functions into coroutine/non-coroutine versions then the note can be removed. Stefan