minor update

This commit is contained in:
Miroslav Stampar 2011-05-29 23:33:34 +00:00
parent 86455ceb9c
commit 6fd8602f01
2 changed files with 46 additions and 31 deletions

View File

@ -341,13 +341,19 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False):
output = __errorFields(expression, expressionFields, expressionFieldsList, expected, num, resumeValue) output = __errorFields(expression, expressionFields, expressionFieldsList, expected, num, resumeValue)
if not kb.threadContinue:
break
if output and isinstance(output, list) and len(output) == 1: if output and isinstance(output, list) and len(output) == 1:
output = output[0] output = output[0]
kb.locks.outputs.acquire() kb.locks.outputs.acquire()
threadData.shared.outputs.append(output) threadData.shared.outputs.append(output)
kb.locks.outputs.release() kb.locks.outputs.release()
except KeyboardInterrupt: except KeyboardInterrupt:
kb.threadContinue = False
kb.threadException = True
raise raise
runThreads(numThreads, errorThread) runThreads(numThreads, errorThread)

View File

@ -273,6 +273,7 @@ def unionUse(expression, unpack=True, dump=False):
threadData.shared.value = "" threadData.shared.value = ""
def unionThread(): def unionThread():
try:
threadData = getCurrentThreadData() threadData = getCurrentThreadData()
while threadData.shared.limits and kb.threadContinue: while threadData.shared.limits and kb.threadContinue:
@ -294,6 +295,9 @@ def unionUse(expression, unpack=True, dump=False):
if not output: if not output:
output = __oneShotUnionUse(limitedExpr, unpack) output = __oneShotUnionUse(limitedExpr, unpack)
if not kb.threadContinue:
break
if output: if output:
kb.locks.value.acquire() kb.locks.value.acquire()
threadData.shared.value += output threadData.shared.value += output
@ -314,6 +318,11 @@ def unionUse(expression, unpack=True, dump=False):
dataToStdout(status, True) dataToStdout(status, True)
kb.locks.ioLock.release() kb.locks.ioLock.release()
except KeyboardInterrupt:
kb.threadContinue = False
kb.threadException = True
raise
runThreads(numThreads, unionThread) runThreads(numThreads, unionThread)
value = threadData.shared.value value = threadData.shared.value