[Spice-devel] [PATCH spice-gtk 2/4] coroutine: fix current coroutine

Christophe Fergeau cfergeau at redhat.com
Mon Nov 18 01:57:12 PST 2013


On Fri, Nov 15, 2013 at 10:03:40PM +0100, Marc-André Lureau wrote:
> When leaving a coroutine, it swaps back to where it came from, not to
> the leader/main coroutine.
> ---
>  gtk/coroutine_ucontext.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c
> index 6251528..889f0d6 100644
> --- a/gtk/coroutine_ucontext.c
> +++ b/gtk/coroutine_ucontext.c
> @@ -103,7 +103,7 @@ void *coroutine_swap(struct coroutine *from, struct coroutine *to, void *arg)
>  		return from->data;
>  	else if (ret == 1) {
>  		coroutine_release(to);
> -		current = &leader;
> +		current = from;

The way we use it, it's probably not different, we are always switching between a
coroutine and the main context, ret == 1 when the destination context has
exited, and hopefully, we are not exiting from the main context when the
coroutine is still alive (ie 'to' which is exiting can't be the leader, so
from == &leader).

However, I agree this patch makes sense, so ACK. I'm wondering if this code
ever gets triggered by spice-gtk?
coroutine-winfibers.c has the same current = &leader; assignment.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20131118/1dec0ea8/attachment.pgp>


More information about the Spice-devel mailing list