<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:10pt"><div></div><div>Had you take a look on how aptcc handles cancel?</div><div>Since zypp is a C++ backend too you can sure</div><div>use this way.</div><div><br></div><div>First store a pointer in the pk-object to a bool* cancel;</div><div>on the pk_cancel() you set cancel = true;</div><div>then on the methods you use you do a few checks</div><div>if (cancel) { break; } or something...</div><div><br></div><div>Best.<br>&nbsp;</div>________________________________<br>Daniel Nicoletti - KDE Developer<br><span><a target="_blank" href="http://dantti.wordpress.com">http://dantti.wordpress.com</a></span><br>When a wicked man dies, his hope perishes;<br>all he expected from his power comes to nothing. Prov. 11:7<div><br></div><blockquote style="border-left: 2px solid rgb(16, 16, 255);
 margin-left: 5px; padding-left: 5px;"><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Tahoma"><b><span style="font-weight: bold;">De:</span></b> "Zhang, Qiang Z" &lt;qiang.z.zhang@intel.com&gt;<br><b><span style="font-weight: bold;">Para:</span></b> "hughsient@gmail.com" &lt;hughsient@gmail.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> "packagekit@lists.freedesktop.org" &lt;packagekit@lists.freedesktop.org&gt;<br><b><span style="font-weight: bold;">Enviadas:</span></b> Quinta-feira, 16 de Dezembro de 2010 1:01:12<br><b><span style="font-weight: bold;">Assunto:</span></b> [packagekit] (no subject)<br></font><br><meta http-equiv="x-dns-prefetch-control" content="off">

 
 

<style><!--.EmailQuote {margin-left:1pt;padding-left:4pt;border-left:#800000 2px solid;}--></style>


<font face="Calibri, sans-serif" size="2">
<div>Hi Richard,</div>
<div>&nbsp;</div>
<div>I want to implemented the cancel API for zypp backend. But have not found the proper way.</div>
<div>&nbsp;</div>
<div>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.</div>
<div>&nbsp;</div>
<div>But for the backend,&nbsp; which don’t use PkBackendSpawn,&nbsp; 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.</div>
<div>&nbsp;</div>
<div>Most of the other backends just set the transaction status and do nothing.</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div>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.</div>
<div>Then all the backend use thread can call pk_backend_thread_cancel to cancel transaction.</div>
<div>&nbsp;</div>
<div>Or any other method?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>-Thanks</div>
<div>-Xiaoqiang</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
</font>


<meta http-equiv="x-dns-prefetch-control" content="on"></div></div></blockquote><div style="position:fixed"></div>


</div><br>



      &nbsp;</body></html>