[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked co
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield |
Date: |
Wed, 7 Aug 2013 21:18:05 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Aug 05, 2013 at 08:44:04PM +0200, Charlie Shepherd wrote:
> From: Charlie Shepherd <address@hidden>
>
> While it only really makes sense to call qemu_coroutine_self() in a coroutine
> context, it cannot actually yield execution itself, so remove the coroutine_fn
> annotation.
> ---
> include/block/coroutine.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
By removing coroutine_fn the rules have changed:
It's now legal to call qemu_coroutine_self() outside a coroutine.
Previously only callers that knew the internals of the coroutine
implementation did that.
coroutine_fn gives coroutine backend implementors more flexibility in
how they choose to implement qemu_coroutine_self(). From an API
perspective I prefer to keep qemu_coroutine_self() marked as a
coroutine_fn.
I guess the practical problem is that CPC will get
upset that it's being called by the coroutine implementation from
non-coroutine contexts. This can be solved:
1. Keep the public qemu_coroutine_self() marked coroutine_fn.
2. Have it call an internal coroutine_self() function that is not
coroutine_fn.
This way the API stays strict and the internal implementation doesn't
violate the coroutine_fn calling rule.
Stefan
- [Qemu-devel] RFC: [PATCH 0/5] Explicitly annotating coroutine_fn functions, Charlie Shepherd, 2013/08/05
- [Qemu-devel] [PATCH 1/5] Add an explanation of when a function should be marked coroutine_fn, Charlie Shepherd, 2013/08/05
- [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Charlie Shepherd, 2013/08/05
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield,
Stefan Hajnoczi <=
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Gabriel Kerneis, 2013/08/07
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Charlie Shepherd, 2013/08/07
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Gabriel Kerneis, 2013/08/08
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Charlie Shepherd, 2013/08/08
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Gabriel Kerneis, 2013/08/08
- Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield, Charlie Shepherd, 2013/08/07
[Qemu-devel] [PATCH 3/5] Convert BlockDriver to explicit coroutine annotations, Charlie Shepherd, 2013/08/05