Rework keepalive to use time.sleep() instead of event.wait()

This should improve power-management abilities some more

The catch is that we can't wait any longer for the kathread to
terminate.  We were waiting for this in some cases.  This is probably
not a big deal.

fixes deb#434074
fixes #66
This commit is contained in:
John Goerzen
2008-08-02 17:04:32 -05:00
parent b9f73621a5
commit 2a852a8f48
4 changed files with 9 additions and 17 deletions

View File

@ -83,16 +83,10 @@ class Account(CustomConfig.ConfigHelperMixin):
refreshperiod = int(self.refreshperiod * 60)
sleepresult = self.ui.sleep(refreshperiod)
if sleepresult == 2:
# Cancel keep-alive, but don't bother terminating threads
for item in kaobjs:
item.stopkeepalive(abrupt = 1)
return sleepresult
else:
# Cancel keep-alive and wait for thread to terminate.
for item in kaobjs:
item.stopkeepalive(abrupt = 0)
return sleepresult
# Cancel keepalive
for item in kaobjs:
item.stopkeepalive()
return sleepresult
class AccountSynchronizationMixin:
def syncrunner(self):