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: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
similarity (apart from the name) is that both use g_object_ref() to
ensure the object does not die during some work they do, there are
probably a lot of functions doing that.
Feel free to add the scenario to the log for future readers.


Christophe

Attachment: pgpK9Q0ke8yqu.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]