From d54859a9318baf6d6eb000a82793d3beff20f547 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Wed, 2 Nov 2011 11:29:23 +0100 Subject: [PATCH] Don't setDaemon explicitly, it's done inherently All ExitNotifyThreads and InstanceLimitThreads are setDaemon(True) in their constructor, so there is no need to do that again in the code. Signed-off-by: Sebastian Spaeth --- offlineimap/accounts.py | 1 - offlineimap/folder/Base.py | 1 - offlineimap/init.py | 1 - offlineimap/threadutil.py | 4 ++-- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 7387c51..7a87791 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -291,7 +291,6 @@ class SyncableAccount(Account): name = "Folder %s [acc: %s]" % (remotefolder, self), args = (self.name, remoterepos, remotefolder, localrepos, statusrepos, quick)) - thread.setDaemon(1) thread.start() folderthreads.append(thread) # wait for all threads to finish diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 91ee08a..f8cea25 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -341,7 +341,6 @@ class BaseFolder(object): target = self.copymessageto, name = "Copy message from %s:%s" % (self.repository, self), args = (uid, dstfolder, statusfolder)) - thread.setDaemon(1) thread.start() threads.append(thread) else: diff --git a/offlineimap/init.py b/offlineimap/init.py index 0e5b08d..36240ac 100644 --- a/offlineimap/init.py +++ b/offlineimap/init.py @@ -358,7 +358,6 @@ class OfflineImap: name='Sync Runner', kwargs = {'accounts': syncaccounts, 'config': self.config}) - t.setDaemon(True) t.start() threadutil.exitnotifymonitorloop(threadutil.threadexited) self.ui.terminate() diff --git a/offlineimap/threadutil.py b/offlineimap/threadutil.py index 2dfb194..e94910b 100644 --- a/offlineimap/threadutil.py +++ b/offlineimap/threadutil.py @@ -28,8 +28,8 @@ from offlineimap.ui import getglobalui ###################################################################### def semaphorereset(semaphore, originalstate): - """Wait until the semaphore gets back to its original state -- all acquired - resources released.""" + """Block until `semaphore` gets back to its original state, ie all acquired + resources have been released.""" for i in range(originalstate): semaphore.acquire() # Now release these.