fixed that thread partial output problem (one character behind) reported by Kasper Fons

This commit is contained in:
Miroslav Stampar 2010-05-11 11:06:21 +00:00
parent 74860fee2a
commit 430a25407b

View File

@ -194,6 +194,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
index = [ firstChar ] # As list for python nested function scoping index = [ firstChar ] # As list for python nested function scoping
idxlock = threading.Lock() idxlock = threading.Lock()
iolock = threading.Lock() iolock = threading.Lock()
valuelock = threading.Lock()
conf.seqLock = threading.Lock() conf.seqLock = threading.Lock()
conf.threadContinue = True conf.threadContinue = True
@ -220,7 +221,10 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
else: else:
break break
valuelock.acquire()
value[curidx-1] = val value[curidx-1] = val
currentValue = list(value)
valuelock.release()
if conf.threadContinue: if conf.threadContinue:
if showEta: if showEta:
@ -230,7 +234,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
endCharIndex = 0 endCharIndex = 0
for i in xrange(length): for i in xrange(length):
if value[i] is not None: if currentValue[i] is not None:
endCharIndex = max(endCharIndex, i) endCharIndex = max(endCharIndex, i)
output = '' output = ''
@ -240,11 +244,11 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
count = 0 count = 0
for i in xrange(startCharIndex, endCharIndex): for i in xrange(startCharIndex, endCharIndex + 1):
output += '_' if value[i] is None else value[i] output += '_' if currentValue[i] is None else currentValue[i]
for i in xrange(length): for i in xrange(length):
count += 1 if value[i] is not None else 0 count += 1 if currentValue[i] is not None else 0
if startCharIndex > 0: if startCharIndex > 0:
output = '..' + output[2:] output = '..' + output[2:]