[packagekit] Question about pk_backend_thread_helper ()
Boyd Timothy
btimothy at gmail.com
Tue Nov 27 15:31:30 PST 2007
I recall reading something that our backends should spawn threads to
do heavy lifting so they don't block the UI. Today I've been adding
code to add progress information to the zypp backend. Unfortunately,
it doesn't appear that the pk_backend_thread_helper() is doing what it
ought to do.
I noticed that pk_backend_thread_helper () actually joins the spawned
thread and waits for it to finished. If this is what's happening, how
does that allow the GUI to continue on? Using this function, my
progress information is not being reflected in the UI
("pk-install-package lynx" or "pkcon install lynx"). At the very end
after the package has been downloaded and installed, the UI will
quickly display at 100% before quitting.
So, I've experimented with pk_backend_create_thread () instead. Using
this fuction, the GUI now responds to my progress updates. But, of
course, now the GUI never receives a pk_backend_finished () message,
so it never exits. Trying to be smart, I added pk_backend_finished ()
to my install thread, but now the pk-daemon is complaining at me.
What is the magic trick to make threading with progress updates work?
I've pushed all my ugly code up to git in case you want to look at the
mess. :)
Cheers,
Boyd
More information about the PackageKit
mailing list