Reformat offlineimap/ui/debuglock.py
Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
parent
1b385dfafb
commit
9aa2344fd4
@ -17,19 +17,21 @@
|
|||||||
|
|
||||||
from threading import Lock, currentThread
|
from threading import Lock, currentThread
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
logfile = open("/tmp/logfile", "wt")
|
logfile = open("/tmp/logfile", "wt")
|
||||||
loglock = Lock()
|
loglock = Lock()
|
||||||
|
|
||||||
|
|
||||||
class DebuggingLock:
|
class DebuggingLock:
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.lock = Lock()
|
self.lock = Lock()
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
def acquire(self, blocking = 1):
|
def acquire(self, blocking=1):
|
||||||
self.print_tb("Acquire lock")
|
self.print_tb("Acquire lock")
|
||||||
self.lock.acquire(blocking)
|
self.lock.acquire(blocking)
|
||||||
self.logmsg("===== %s: Thread %s acquired lock\n"%
|
self.logmsg("===== %s: Thread %s acquired lock\n" %
|
||||||
(self.name, currentThread().getName()))
|
(self.name, currentThread().getName()))
|
||||||
|
|
||||||
def release(self):
|
def release(self):
|
||||||
self.print_tb("Release lock")
|
self.print_tb("Release lock")
|
||||||
@ -42,8 +44,6 @@ class DebuggingLock:
|
|||||||
loglock.release()
|
loglock.release()
|
||||||
|
|
||||||
def print_tb(self, msg):
|
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) + \
|
(self.name, currentThread().getName(), msg) + \
|
||||||
"\n".join(traceback.format_list(traceback.extract_stack())))
|
"\n".join(traceback.format_list(traceback.extract_stack())))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user