Re: [PATCH spice-gtk 11/13] coroutine: reference object when signaling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 12, 2014 at 12:46:40PM -0500, Marc-André Lureau wrote:
> 
> 
> ----- Original Message -----
> > On Wed, Nov 12, 2014 at 12:10:26PM -0500, Marc-André Lureau wrote:
> > > 
> > > 
> > > ----- Original Message -----
> > > > Hey,
> > > > 
> > > > On Sun, Nov 09, 2014 at 05:31:43PM +0100, Marc-André Lureau wrote:
> > > > > Before the signal is acutally emitted, the channel may be
> > > > 
> > > > 'actually'
> > > > 
> > > > > released. Similarly to g_signal_emit, take a reference before yielding
> > > > > to main context.
> > > > 
> > > > I would drop the "similarly to g_signal_emit" as your purpose is most
> > > > likely different. The ref is needed here as the signal emission is
> > > > async, so code can run before the signal emission, but g_signal_emit is
> > > > synchronous.
> > > > 
> > > > I assume the scenario you want to protect against is
> > > > - (coroutine context)g_coroutine_signal_emit is called
> > > >   - the signal emission is scheduled in an idle with g_idle_add
> > > >   - coroutine_yield() is called
> > > > - (main context)code runs which drops the last ref on the channel
> > > > - (main context)idle runs and tries to emit the signal
> > > > 
> > > > 
> > > > Patch looks good if this is the correct scenario.
> > > 
> > > Yes, I maintain "similarly", because we want to maintain object alive
> > > during g_coroutine_signal_emit(). I think it is thus appropriate here.
> > 
> > g_signal_emit and g_coroutine_signal_emit want to keep the object alive
> > for very different reasons, so I would not say "similarly". The only
> 
> g_coroutine_signal_emit() and g_signal_emit() both want to keep object alive during the function time.
> 
> Anyway, I don't think it's worth arguing about your interpretation, I rephrase:
> 
> "Let's keep a reference to the object during
> the function time, to prevent the object from being destroyed before
> calling g_signal_emit() in main context."

Works for me, ACK.


Attachment: pgpWGLmQGJddL.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]