Implement true single-threading

Previously, we would spawn child threads for account synchronization
even if we had single-threading enabled. This prevented us from catching
the true location of exceptions, for example. Now, in single-threaded
mode, we perform the account synchronization truely in the main thread
which will ease our debugging.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth
2011-01-12 11:15:12 +01:00
committed by Nicolas Sebrecht
parent 760698253b
commit b81b7d6001
2 changed files with 29 additions and 14 deletions

View File

@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from offlineimap import mbnames
from offlineimap.threadutil import threadlist, InstanceLimitedThread, ExitNotifyThread
from offlineimap.accounts import SyncableAccount, SigListener
from threading import currentThread
@ -33,11 +32,10 @@ def syncaccount(threads, config, accountname, siglisteners):
thread.setDaemon(1)
thread.start()
threads.add(thread)
def syncitall(accounts, config, siglisteners):
currentThread().setExitMessage('SYNC_WITH_TIMER_TERMINATE')
threads = threadlist()
mbnames.init(config, accounts)
for accountname in accounts:
syncaccount(threads, config, accountname, siglisteners)
# Wait for the threads to finish.