[packagekit] Run pkclient action from thread
Matthias Klumpp
matthias at nlinux.org
Mon Apr 19 05:02:11 PDT 2010
On Mon, 19 Apr 2010 10:28:45 +0100, Richard Hughes <hughsient at gmail.com>
wrote:
> That's exactly why the PkClient is asynchronous. You don't have to run
> it in a thread to get a non-blocking UI, you just connect up the Gio
> completion and then do other stuff while the client is waiting for a
> response from the server. Have a look at the gnome-packagekit code for
> an example.
I do it that way now - the threading was some kind of experiment, doing the
PackageKit actions asynchronously is much better.
>
> I think it would be a good idea to try to identify the original
> freeze. If you could point to the code I can certainly have a look.
Thank you! But I recently discovered the reason for the error: The library
called g_type_init() to intialize the GType-System. I removed the line, but
forgot that the function was also called in another place of the lib. (It
was some crap left by two committed patches. I reverted the second one,
which caused some other errors and left the first, which brought the
duplicate function)
With a Qt4 GUI, the Qt application does - of course - not call
g_type_init(), so I didn't get any error. But the GTK+ GUI does it. A
doubled call of g_type_init() caused this strange error.
My testsuite for the bindings did not throw an error, because the call was
disabled with a compilerswitch. I really don't know why this happened
exactly (Why does GLib not throw a warning if g_type_init() was already
called?), but the issue is fixed now and I learned to check 3rd-party
patches a little bit more carefully, especially if they are cluttered.
> It's likely the thread has blocked and is not processing further
> methods to the daemon. This may be a threading bug in dbus-glib, or it
> may be a thread issue with your code.
It seems glib has blocked the application somehow... Or it did something to
the mainloop... Maybe I find a GLib developer to explain how this exactly
happened and why it did not happen on Fedora 12 (the reason why I never saw
this bug)
Sorry for bothering you with something which was actually my fault, but I
thought the PackageKit log messages could give me at least a little hint.
I skip the stupid threading experiments and go back to the previous
solution.
Thank you for your friendly help!
Matthias
More information about the PackageKit
mailing list