[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_corou
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper |
Date: |
Wed, 14 Aug 2013 16:21:24 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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();
}
- [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper, Charlie Shepherd, 2013/08/09
- Re: [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper,
Stefan Hajnoczi <=
- [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create., Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 07/15] Call bdrv->open via a synchronous wrapper in block/snapshot.c, Charlie Shepherd, 2013/08/09