Null out lock vars so that __del__ gets called

The builder was holding lock variables in the loop which means that
sometimes a state.Lock object would be created for the same file-id
twice, triggering the assertion. Assign the lock variables to None to
ensure that the state.Lock objects are destroyed before creating the
next one in the loop.
This commit is contained in:
Alan Falloon 2015-01-15 16:13:35 -05:00 committed by Avery Pennarun
commit 9354e78871

View file

@ -348,6 +348,7 @@ def main(targets, shouldbuildfunc):
BuildJob(t, f, lock, shouldbuildfunc, done).start() BuildJob(t, f, lock, shouldbuildfunc, done).start()
state.commit() state.commit()
assert(state.is_flushed()) assert(state.is_flushed())
lock = None
del lock del lock
@ -401,5 +402,6 @@ def main(targets, shouldbuildfunc):
else: else:
BuildJob(t, state.File(id=fid), lock, BuildJob(t, state.File(id=fid), lock,
shouldbuildfunc, done).start() shouldbuildfunc, done).start()
lock = None
state.commit() state.commit()
return retcode[0] return retcode[0]