Re: [Rhythmbox-devel] Calling an executable for each song in rb library



On Fri, Jun 27, 2008 at 11:29:06AM -0400, Charlotte Curtis wrote:
> On Fri, Jun 27, 2008 at 10:38 AM, Jonathan Matthew
> <notverysmart gmail com> wrote:
> > Both the child watch and the timeout will only work when the GLib main
> > loop is running.
> Okay, that's what I (eventually) figured out.  Does it present a
> problem for my plugin to have its own main loop (as in the email I
> sent a few minutes before yours)?

Recursive/nested mainloops make me very nervous.  They bring up a
variety of horrible locking concerns and make it harder to understand
what's going on.  I think it'd be best to avoid doing this, but
obviously if nothing else works, then I guess you'll have to.

> > Either your plugin has to return control
> > from whatever callback or handler is being called, then process the next
> > file in the child watch or timeout callback, or it can create a
> > thread to do this.
> I *think* that's what I'm doing by starting the main loop after
> spawning the process, and then stopping it when the process completes.
>  So far, I haven't run into any problems.

I can't think of any specific problems that you're likely to see as a
result of doing this, but we have had related problems in the past, and
they're always bizarre things that show up six months down the line.

> > Query models cannot safely be used from multiple threads, so you'll
> > probably have to go with the former, and instead of
> > 'for for in model:', I think you'll need to pass around a gtk.TreeIter
> > between callbacks to keep track of where you're up to.
> I discovered the problem of query models + multiple threads... not
> good!  I was thinking of the gtk.TreeIter idea - having some kind of
> signal-callback system where it progresses to the next item, but it
> seems like a pain.

Yeah, unfortunately this stuff does get complicated.  I'd much rather
deal with the complexity up front (and I'm happy to help you get this
working), though, than track down an occasional deadlock next year.



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