[packagekit] Run pkclient action from thread
hughsient at gmail.com
Mon Apr 19 02:28:45 PDT 2010
On 16 April 2010 19:00, Matthias Klumpp <matthias at nlinux.org> wrote:
> This is a little bit difficult... I have written a library which makes use
> of PackageKit in several ways (search for packages/files, resolve names
> etc.). It also runs a lot of other stuff, which blocks the GUI application
> that makes use of the lib as long as these processes run.
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
> Conclusion: I hadn't any "good" reason for running all in threads, except
> for the whish to avoid the UI freeze. Unfortunately this did not solve the
> problem but therefore the app now sometimes crashes cause I use dbus-glib
> too which is - as you said - not threadsafe. I reverted the experimental
> changes and wanted to know now if it makes sense to continue searching in
> this direction.
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.
> - 1 have an unknown role (GetTid then nothing?)
See this page for details on how it works:
> Could you please explain those lines? Why is the daemon not processing my
> request or throwing an error message?
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.
More information about the PackageKit