diff --git a/head/offlineimap/threadutil.py b/head/offlineimap/threadutil.py index e86dd42..cc638c7 100644 --- a/head/offlineimap/threadutil.py +++ b/head/offlineimap/threadutil.py @@ -46,7 +46,7 @@ def threadsreset(threadlist): ###################################################################### exitcondition = Condition(Lock()) -exitthread = None +exitthreads = [] inited = 0 def initexitnotify(): @@ -55,7 +55,7 @@ def initexitnotify(): This SHOULD be called before the main thread starts any other ExitNotifyThreads, or else it may miss the ability to catch the exit status from them!""" - exitcondition.acquire() + pass def exitnotifymonitorloop(callback): """Enter an infinite "monitoring" loop. The argument, callback, @@ -67,19 +67,21 @@ def exitnotifymonitorloop(callback): an ExitNotifyThread, or else an infinite loop may result. Furthermore, the monitor will hold the lock all the while the other thread is waiting. """ - global exitcondition, exitthread + global exitcondition, exitthreads while 1: # Loop forever. - while exitthread == None: + exitcondition.acquire() + while not len(exitthreads): exitcondition.wait(1) - callback(exitthread) - exitthread = None - + + while len(exitthreads): + callback(exitthreads.pop()) + exitcondition.release() class ExitNotifyThread(Thread): """This class is designed to alert a "monitor" to the fact that a thread has exited and to provide for the ability for it to find out why.""" def run(self): - global exitcondition, exitthread + global exitcondition, exitthreads self.threadid = thread.get_ident() try: Thread.run(self) @@ -94,7 +96,7 @@ class ExitNotifyThread(Thread): if not hasattr(self, 'exitmessage'): self.setExitMessage(None) exitcondition.acquire() - exitthread = self + exitthreads.append(self) exitcondition.notify() exitcondition.release() diff --git a/head/offlineimap/ui/Tk.py b/head/offlineimap/ui/Tk.py index 29a4f58..468518a 100644 --- a/head/offlineimap/ui/Tk.py +++ b/head/offlineimap/ui/Tk.py @@ -175,6 +175,9 @@ class TkUI(UIBase): s.top.destroy() TextOKDialog("Main Program Exception", msg) + def deletingmessages(s, uidlist, destlist): + ds = s.folderlist(destlist) + s._msg("Deleting %d messages in %s" % (len(uidlist), ds)) ################################################## Copied from TTY diff --git a/head/offlineimap/ui/UIBase.py b/head/offlineimap/ui/UIBase.py index c1c5dcb..ff775a9 100644 --- a/head/offlineimap/ui/UIBase.py +++ b/head/offlineimap/ui/UIBase.py @@ -156,7 +156,7 @@ class UIBase: Return 0 for normal sleep, or 1 to indicate a request to sync immediately.""" - s._msg("Next refresh in %d seconds" % remainingsec) + s._msg("Next refresh in %d seconds" % remainingsecs) if sleepsecs > 0: time.sleep(sleepsecs) return 0