[packagekit] About Transaction Cancel Method

Zhang, Qiang Z qiang.z.zhang at intel.com
Fri Dec 17 00:54:25 PST 2010


Thanks for your notice.

I have spent some time to review code of aptcc, and fount some clues, thanks.

But this method only can cancel on some program point, so if the download library is downloading packages, this method cant cancel it immediately. Right?

Thanks
Xiaoqiang


From: packagekit-bounces+qiang.z.zhang=intel.com at lists.freedesktop.org [mailto:packagekit-bounces+qiang.z.zhang=intel.com at lists.freedesktop.org] On Behalf Of Daniel Nicoletti
Sent: Thursday, December 16, 2010 11:23 AM
To: packagekit at lists.freedesktop.org
Cc: packagekit at lists.freedesktop.org
Subject: Re: [packagekit] (no subject)

Had you take a look on how aptcc handles cancel?
Since zypp is a C++ backend too you can sure
use this way.

First store a pointer in the pk-object to a bool* cancel;
on the pk_cancel() you set cancel = true;
then on the methods you use you do a few checks
if (cancel) { break; } or something...

Best.

________________________________
Daniel Nicoletti - KDE Developer
http://dantti.wordpress.com
When a wicked man dies, his hope perishes;
all he expected from his power comes to nothing. Prov. 11:7


De: "Zhang, Qiang Z" <qiang.z.zhang at intel.com>
Para: "hughsient at gmail.com" <hughsient at gmail.com>
Cc: "packagekit at lists.freedesktop.org" <packagekit at lists.freedesktop.org>
Enviadas: Quinta-feira, 16 de Dezembro de 2010 1:01:12
Assunto: [packagekit] (no subject)


Hi Richard,

I want to implemented the cancel API for zypp backend. But have not found the proper way.

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.

But for the backend,  which don’t use PkBackendSpawn,  it’s complicated to implemented this transaction cancel method. Such as poldek, which call poldek’s sigint_emit () to cancel transaction and sigint_emit is implemented in poldek but not PackageKit.

Most of the other backends just set the transaction status and do nothing.

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.

Or any other method?


-Thanks
-Xiaoqiang




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20101217/f74bed50/attachment-0003.htm>


More information about the PackageKit mailing list