[Spice-devel] [spice v10 10/27] server: Make the RedDrawable refcount thread-safe

Christophe Fergeau cfergeau at redhat.com
Wed Mar 23 10:04:06 UTC 2016


On Mon, Mar 21, 2016 at 07:43:20PM +0100, Francois Gouget wrote:
> On Thu, 3 Mar 2016, Christophe Fergeau wrote:
> [...]
> > Making the refcounting thread safe is one thing, but then the code
> > freeing the drawable needs to be thread-safe too. red_put_drawable might
> > be fine (only looked briefly), but release_resource which is a vfunc
> > provided by QEMU seems much less obvious. I think the drawable refcount
> > is changed in the display channel thread, so I would try to queue an
> > idle on its main_context, and do the unref from there. Hopefully it will
> > not be too messy... (and I'll mention again
> > g_main_context_push_thread_default which could be useful there ;) or
> > some thread-local storage variable).
> > 
> > By "queueing an idle", I mean something like
> > GSource *source = g_idle_source_new();
> > g_source_set_callback(..);
> > g_source_attach(source, worker->core.main_context);
> 
> I have tried this approach but I get a feeling it cannot work and is 
> fundamentally flawed :-( There are two sticking points, the dependency 
> on the glib main loop and getting access to main_context.

By the way, as I remember it, I only had minor comments on a good part
of the series, if you have revised versions of the first patches (let's
say up to this one), can you resend them, this way they could be merged
without blocking on this work.

Thanks,

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/43cc725d/attachment.sig>


More information about the Spice-devel mailing list