]> code.delx.au - offlineimap/commitdiff
/offlineimap/head: changeset 453
authorjgoerzen <jgoerzen>
Tue, 29 Apr 2003 00:04:22 +0000 (01:04 +0100)
committerjgoerzen <jgoerzen>
Tue, 29 Apr 2003 00:04:22 +0000 (01:04 +0100)
Backed out removal of SYNC_WITH_TIMER_TERMINATE code to deal with
completed syncs. Without this code, -o broke because the app would
never terminate.

offlineimap/head/debian/changelog
offlineimap/head/offlineimap/syncmaster.py
offlineimap/head/offlineimap/threadutil.py

index 9a2f6cbf81b1bb1a0d833b76c3125182e8491350..7910aa32b11c88fa92ce56b636f3223c1df03460 100644 (file)
@@ -1,3 +1,11 @@
+offlineimap (3.99.15) unstable; urgency=low
+
+  * Backed out removal of SYNC_WITH_TIMER_TERMINATE code to deal with
+    completed syncs.  Without this code, -o broke because the app would
+    never terminate.  Closes: #FIXME.
+
+ -- John Goerzen <jgoerzen@complete.org>  Mon, 28 Apr 2003 14:00:32 -0500
+
 offlineimap (3.99.14) unstable; urgency=low
 
   * Added the ability to use the top level of a Maildir as folder named
index 72497338c2d7979cacb39400c750c402c4db417a..4c720aa3664f9ce45dee0fb8383d06b422d75cd0 100644 (file)
@@ -1,5 +1,5 @@
 # OfflineIMAP synchronization master code
-# Copyright (C) 2002, 2003 John Goerzen
+# Copyright (C) 2002 John Goerzen
 # <jgoerzen@complete.org>
 #
 #    This program is free software; you can redistribute it and/or modify
@@ -25,16 +25,21 @@ import re, os, os.path, offlineimap, sys
 from ConfigParser import ConfigParser
 from threading import *
 
-def syncaccount(config, accountname):
+def syncaccount(threads, config, accountname):
     account = SyncableAccount(config, accountname)
     thread = InstanceLimitedThread(instancename = 'ACCOUNTLIMIT',
                                    target = account.syncrunner,
                                    name = "Account sync %s" % accountname)
     thread.setDaemon(1)
     thread.start()
+    threads.add(thread)
     
 def syncitall(accounts, config):
+    currentThread().setExitMessage('SYNC_WITH_TIMER_TERMINATE')
     ui = UIBase.getglobalui()
+    threads = threadutil.threadlist()
     mbnames.init(config, accounts)
     for accountname in accounts:
-        syncaccount(config, accountname)
+        syncaccount(threads, config, accountname)
+    # Wait for the threads to finish.
+    threads.reset()
index 096034a0e9c1fa3e75b75de434bba0c4fea8b3f0..87b8973aa7d1ac707707660eb5450367e7356d9f 100644 (file)
@@ -134,6 +134,11 @@ def threadexited(thread):
         ui.threadException(thread)      # Expected to terminate
         sys.exit(100)                   # Just in case...
         os._exit(100)
+    elif thread.getExitMessage() == 'SYNC_WITH_TIMER_TERMINATE':
+        ui.terminate()
+        # Just in case...
+        sys.exit(100)
+        os._exit(100)
     else:
         ui.threadExited(thread)