On Thu, Dec 17, 2015 at 10:04:29AM -0500, Frediano Ziglio wrote: > > > +static void CORE_NAME(timer_start)(SpiceTimer *timer, uint32_t ms) > > > +{ > > > + CORE_NAME(timer_cancel)(timer); > > > + > > > + timer->source = g_timeout_source_new(ms); > > > + spice_assert(timer->source != NULL); > > > + > > > + g_source_set_callback(timer->source, CORE_NAME(timer_func), timer, > > > NULL); > > > + > > > + g_source_attach(timer->source, CORE_MAIN_CONTEXT(timer->opaque)); > > > +} > > > > It's used to pick the correct main context so that things run in the > > correct thread when this is used from a worker thread. > > However, this looks like what > > g_main_context_get_thread_default()/g_main_context_push_thread_default() > > are meant to address (see proposed patch below). > > > > No, this currently does not work. > The function is called also outside the worker thread (I start wondering that > building displar and cursor channel inside the worker thread was right.. > this was changed by one of first refactory patches). Can you be more specific about the commit(s) you have in mind? From my reading of the code, before the switch to glib mainloop, timer_add/timer_start have to be called from the same thread, the comment in worker_get_main_context_from_opaque() would imply that the only timer we area interested in is the one setup in red_channel_client_create(), and this runs in the worker thread for the cursor channel as far as I can tell. I'm most likely missing something, since it's still fresh on your mind, better to ask ;) Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel