[Spice-devel] [spice v10 10/27] server: Make the RedDrawable refcount thread-safe
Christophe Fergeau
cfergeau at redhat.com
Wed Mar 23 11:19:39 UTC 2016
On Wed, Mar 23, 2016 at 07:09:14AM -0400, Frediano Ziglio wrote:
> > For what it's worth, the only thing which is needed is the GMainContext,
> > not the full-fledged RedWorker. It seems going from RedWorker to
> > QXLInstance is easy, but I did not see an obvious way of getting a
> > RedWorker from a QXLInstance.
> > I'm going to sound like a broken record, but adding
> >
> > @@ -1551,14 +1568,34 @@ SPICE_GNUC_NORETURN static void *red_worker_main(void
> > *arg)
> > RED_CHANNEL(worker->cursor_channel)->thread_id = pthread_self();
> > RED_CHANNEL(worker->display_channel)->thread_id = pthread_self();
> >
> > + g_main_context_push_thread_default(worker->core.main_context);
> > GMainLoop *loop = g_main_loop_new(worker->core.main_context, FALSE);
> > g_main_loop_run(loop);
> > g_main_loop_unref(loop);
> > + g_main_context_pop_thread_default(worker->core.main_context);
> >
> > /* FIXME: free worker, and join threads */
> > exit(0);
> > }
> >
> > and using g_main_context_get_thread_default() at the right time (ie when we
> > are
> > in the display thread, not in one of the GStreamer threads) would do the
> > trick as well.
> >
>
> yes, but g_main_context_push_thread_default works if you are using the same
> thread but if GStreamer spawn their own thread you still have to get the
> context from there.
The spice-side encoding code runs from the display thread, so you would
have to get the GMainContext from this code, not from the code running
in a GStreamer thread, this is what I meant with by "(ie ...)".
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160323/8f0e26e5/attachment.sig>
More information about the Spice-devel
mailing list