[Spice-devel] [spice-gtk 2/3] coroutine: Track idle notification/emission in struct coroutine

Christophe Fergeau cfergeau at redhat.com
Mon Feb 23 04:46:39 PST 2015


On Mon, Feb 23, 2015 at 07:02:07AM -0500, Marc-André Lureau wrote:
> 
> 
> ----- Original Message -----
> > This allows to catch situations when we try to reinit the coroutine
> > using coroutine_init() while a signal/notify idle is pending.
> > 
> > This can actually happen with cancelled migration and connect_delayed
> > (which reinits the current coroutine).
> > If channel_disconnect is called from coroutine context when state is
> > SPICE_CHANNEL_STATE_SWITCHING:
> >     - channel_connect() is called and queues an idle which will call
> >       connect_delayed()
> >     - then spice_session_set_migration_state() is called and will call
> >       g_coroutine_object_notify(), which will queue an idle to emit the
> >       notification, and yield to the main context
> >     - connect_delayed() gets called in an idle, resets the current
> >       coroutine, and then yield back to the coroutine context
> >     - g_coroutine_object_notify() resumes and is confused as the
> >       notification did not happen.
> > 
> > This can be triggered by adding a g_usleep(10000000); at the beginning
> > of spice_session_start_migrating(), and by migrating an oVirt VM after
> > connecting to it.
> 
> Can it still be triggered?

Nope, I'll amend the log.

> 
> > 
> > This is based on a patch suggestion from Marc-André.
> > ---
> >  gtk/coroutine.h          |  1 +
> >  gtk/coroutine_ucontext.c |  5 +++++
> >  gtk/gio-coroutine.c      | 16 ++++++++++++----
> >  3 files changed, 18 insertions(+), 4 deletions(-)
> > 
> > diff --git a/gtk/coroutine.h b/gtk/coroutine.h
> > index 78dc467..5525fd3 100644
> > --- a/gtk/coroutine.h
> > +++ b/gtk/coroutine.h
> > @@ -53,6 +53,7 @@ struct coroutine
> >  	GThread *thread;
> >  	gboolean runnable;
> >  #endif
> > +	guint idle_id;
> >  };
> 
> With GCoroutine we won't be able to add fields to the structs.

I made alternative suggestions in 0/3 to avoid adding that new field.

> 
> In general, all coroutine specific data must be allocated by the
> coroutine itself, either on the stack or by it's own. You'll have to
> create your own interaction protocol to exchange (get/set) these kind
> of data.

I'm not exactly sure what you are suggesting me to do here.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150223/5764d9e9/attachment.sig>


More information about the Spice-devel mailing list