Minor update

This commit is contained in:
Miroslav Stampar
2017-04-19 13:35:36 +02:00
parent 0340ecd38a
commit 81e3395975
4 changed files with 16 additions and 11 deletions

View File

@@ -87,7 +87,7 @@ def getCurrentThreadName():
return threading.current_thread().getName()
def exceptionHandledFunction(threadFunction):
def exceptionHandledFunction(threadFunction, silent=False):
try:
threadFunction()
except KeyboardInterrupt:
@@ -95,8 +95,8 @@ def exceptionHandledFunction(threadFunction):
kb.threadException = True
raise
except Exception, ex:
# thread is just going to be silently killed
logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
if not silent:
logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
def setDaemon(thread):
# Reference: http://stackoverflow.com/questions/190010/daemon-threads-explanation