On Tue, 2008-10-07 at 21:09 +0200, Hans Meine wrote: > I mean that the result of query()'s InProgress could be any object, i.e. a > list or any other python type that has an __iter__ method,
Right. > and in fact that __iter__ method could also be a coroutine (correct > me if I'm wrong), No, the __iter__ method couldn't itself be a coroutine. __iter__ must return a callable that implements .next(). coroutines return InProgress objects. > so it would be possible that during the for-loop over the query > results there is still an open DB connection. I believe the beacon client will always have the DB open (for read-only access) after it connects to the server. When the client wants to query, it tells the server via RPC that it wants to lock the DB, and after it's done accessing the DB directly, it tells the server it's now unlocked by that client. Before we start iterating over anything, the (yield query(...)) expression completes, which means that once we start to iterate over the query results, the DB is unlocked. > I was looking for a reason why the --del-media did not remove the > record properly anymore when I added the loop for finding the media by > name. Hopefully dischi will have an idea. > Actually, I think it would be best (easiest to understand, step-by-step) if > you put the above explanation below the sentence which I did not understand > correctly. [...] Your suggested text looks good to me. I'd not object if you made that change to the wiki. :) > Ah, ok. So maybe add the sentence "Using MainThreadCallback directly, one > may > circumvent the overhead of @kaa.threaded("kaa.MAINTHREAD") in those cases > where the function is called from the main thread already." I actually think it's not worth commenting about any overhead. The difference between MainThreadCallback(foo)() and foo() if foo is decorated with @kaa.threaded is probably insignificant. If you really are concerned about the difference in overhead, you probably should be coding in C :) The rule of thumb is: if you have a function that must always be called in the main thread, then you decorate it with @kaa.threaded. If you need to decide case-by-case, don't decorate it and use MainThreadCallback when needed. BTW, note it's @kaa.threaded(kaa.MAINTHREAD) and not @kaa.threaded("kaa.MAINTHREAD") Cheers, Jason. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel