diff --git a/offlineimap/ui/debuglock.py b/offlineimap/ui/debuglock.py index 673efb0..4757453 100644 --- a/offlineimap/ui/debuglock.py +++ b/offlineimap/ui/debuglock.py @@ -17,19 +17,21 @@ from threading import Lock, currentThread import traceback + logfile = open("/tmp/logfile", "wt") loglock = Lock() + class DebuggingLock: def __init__(self, name): self.lock = Lock() self.name = name - def acquire(self, blocking = 1): + def acquire(self, blocking=1): self.print_tb("Acquire lock") self.lock.acquire(blocking) - self.logmsg("===== %s: Thread %s acquired lock\n"% - (self.name, currentThread().getName())) + self.logmsg("===== %s: Thread %s acquired lock\n" % + (self.name, currentThread().getName())) def release(self): self.print_tb("Release lock") @@ -42,8 +44,6 @@ class DebuggingLock: loglock.release() def print_tb(self, msg): - self.logmsg(".... %s: Thread %s attempting to %s\n"% \ + self.logmsg(".... %s: Thread %s attempting to %s\n" % \ (self.name, currentThread().getName(), msg) + \ "\n".join(traceback.format_list(traceback.extract_stack()))) - -