<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Robin Norwood wrote:
<blockquote cite="mid:xf44pgo31vf.fsf@solitude.devel.redhat.com"
type="cite">
<pre wrap="">Tim Lauridsen <a class="moz-txt-link-rfc2396E" href="mailto:tla@rasmil.dk"><tla@rasmil.dk></a> writes:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">The still is needing some signal catching to work with the abort case.
</pre>
</blockquote>
<pre wrap="">i have added some code so yum is unlocked on SIGQUIT, but i don't know
to test it.
</pre>
</blockquote>
<pre wrap=""><!---->
Cool. However, it looks like the way things are now it will just abort
if something else has the lock - shouldn't we wait around awhile, and
perhaps notify PK with a signal?
So instead of:
def doLock(self):
''' Lock Yum'''
if not self.isLocked():
try: # Try to lock yum
self.yumbase.doLock( YUM_PID_FILE )
PackageKitBaseBackend.doLock(self)
except:
self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')
We do something like:
def doLock(self):
''' Lock Yum'''
retries = 0
while not self.isLocked():
try: # Try to lock yum
self.yumbase.doLock( YUM_PID_FILE )
PackageKitBaseBackend.doLock(self)
except:
sleep(6)
retries++
if retries > 100:
self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')
What do you think?
</pre>
</blockquote>
Look fine, i have commit a slightly modified edition (2s delay &
submitting a wait signal)<br>
<blockquote cite="mid:xf44pgo31vf.fsf@solitude.devel.redhat.com"
type="cite">
<pre wrap="">
Also, looking at yumBackend.py, I'm a little confused now - it looks
like there are two sets of lock/unlock code: do(Un)Lock and
_(un)lock_yum. I can't really see why there are two different sets of
methods...
-RN
</pre>
</blockquote>
Some old code for a first try on locking, i missed to clean it up, it
should be gone now :)<br>
<br>
Tim<br>
</body>
</html>