Reformat offlineimap/threadutil.py
Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
parent
973e3324ff
commit
74ae944b06
@ -20,12 +20,11 @@ from queue import Queue, Empty
|
|||||||
import traceback
|
import traceback
|
||||||
from offlineimap.ui import getglobalui
|
from offlineimap.ui import getglobalui
|
||||||
|
|
||||||
|
|
||||||
STOP_MONITOR = 'STOP_MONITOR'
|
STOP_MONITOR = 'STOP_MONITOR'
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# General utilities
|
# General utilities
|
||||||
######################################################################
|
|
||||||
|
|
||||||
def semaphorereset(semaphore, originalstate):
|
def semaphorereset(semaphore, originalstate):
|
||||||
"""Block until `semaphore` gets back to its original state, ie all acquired
|
"""Block until `semaphore` gets back to its original state, ie all acquired
|
||||||
@ -37,6 +36,7 @@ def semaphorereset(semaphore, originalstate):
|
|||||||
for i in range(originalstate):
|
for i in range(originalstate):
|
||||||
semaphore.release()
|
semaphore.release()
|
||||||
|
|
||||||
|
|
||||||
class accountThreads(object):
|
class accountThreads(object):
|
||||||
"""Store the list of all threads in the software so it can be used to find out
|
"""Store the list of all threads in the software so it can be used to find out
|
||||||
what's running and what's not."""
|
what's running and what's not."""
|
||||||
@ -73,6 +73,7 @@ class accountThreads(object):
|
|||||||
|
|
||||||
exitedThreads = Queue()
|
exitedThreads = Queue()
|
||||||
|
|
||||||
|
|
||||||
def monitor():
|
def monitor():
|
||||||
"""An infinite "monitoring" loop watching for finished ExitNotifyThread's.
|
"""An infinite "monitoring" loop watching for finished ExitNotifyThread's.
|
||||||
|
|
||||||
@ -111,16 +112,16 @@ def monitor():
|
|||||||
# Do not send it back to UI layer right now.
|
# Do not send it back to UI layer right now.
|
||||||
# Maybe later send it to ui.terminate?
|
# Maybe later send it to ui.terminate?
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
ui.threadException(thread) # Expected to terminate the program.
|
ui.threadException(thread) # Expected to terminate the program.
|
||||||
# Should never hit this line.
|
# Should never hit this line.
|
||||||
raise AssertionError("thread has 'exit_exception' set to"
|
raise AssertionError("thread has 'exit_exception' set to"
|
||||||
" '%s' [%s] but this value is unexpected"
|
" '%s' [%s] but this value is unexpected"
|
||||||
" and the ui did not stop the program."%
|
" and the ui did not stop the program." %
|
||||||
(repr(thread.exit_exception), type(thread.exit_exception)))
|
(repr(thread.exit_exception), type(thread.exit_exception)))
|
||||||
|
|
||||||
# Only the monitor thread has this exit message set.
|
# Only the monitor thread has this exit message set.
|
||||||
elif thread.exit_message == STOP_MONITOR:
|
elif thread.exit_message == STOP_MONITOR:
|
||||||
break # Exit the loop here.
|
break # Exit the loop here.
|
||||||
else:
|
else:
|
||||||
ui.threadExited(thread)
|
ui.threadExited(thread)
|
||||||
except Empty:
|
except Empty:
|
||||||
@ -189,6 +190,7 @@ class ExitNotifyThread(Thread):
|
|||||||
|
|
||||||
limitedNamespaces = {}
|
limitedNamespaces = {}
|
||||||
|
|
||||||
|
|
||||||
def initInstanceLimit(limitNamespace, instancemax):
|
def initInstanceLimit(limitNamespace, instancemax):
|
||||||
"""Initialize the instance-limited thread implementation.
|
"""Initialize the instance-limited thread implementation.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user