[packagekit] (no subject)
Richard Hughes
hughsient at gmail.com
Thu Dec 16 00:49:01 PST 2010
On 16 December 2010 03:01, Zhang, Qiang Z <qiang.z.zhang at intel.com> wrote:
> I have reviewed the cancel method of other backends, and found it’s easy to
> call pk_backend_spawn_kill (spawn) if backend use PkBackendSpawn.
Right, killing a process with SIGQUIT and then SIGKILL is a pretty
easy thing to handle.
> I think, can PackageKit provide a function pk_backend_thread_cancel in
> pk-backend.c to send signal to the backend thread, the signal handler in
> thread can release some resources then call g_thread_exit to exit.
> Then all the backend use thread can call pk_backend_thread_cancel to cancel
> transaction.
When a thread is running, it's very hard to "send it a signal" as it's
essentially sharing the original process address space. As with any
threaded program you have to check if the transaction is cancelled
frequently, and if it is, then exit _cleanly_ freeing memory and that
kind of thing. Zif checks for cancelled after pretty much every thing
it does (it's done in the zif_state_done() function).
Because zypp is not spawned (a good thing) you can't just leave the OS
to clean up after the thread by doing something like a pthread quit.
Richard.
More information about the PackageKit
mailing list