Add a --debug-locks option.

Get rid of the "locked..." and "...unlocked!" messages by default, since
they're not usually interesting.  But add a new option to bring them back in
case we end up with trouble debugging the locking stuff.  (I don't really
100% trust it yet, although I haven't had a problem for a while now.)
This commit is contained in:
Avery Pennarun 2010-11-21 06:23:41 -08:00
commit 03a054ca79
3 changed files with 8 additions and 2 deletions

View file

@ -127,7 +127,8 @@ def main(targets, buildfunc):
lock = state.Lock(t)
lock.trylock()
if not lock.owned:
log('%s (locked...)\n' % _nice(t))
if vars.DEBUG_LOCKS:
log('%s (locked...)\n' % _nice(t))
locked.append(t)
else:
jwack.start_job(t, lock,
@ -142,7 +143,8 @@ def main(targets, buildfunc):
lock.wait()
lock.trylock()
assert(lock.owned)
log('%s (...unlocked!)\n' % _nice(t))
if vars.DEBUG_LOCKS:
log('%s (...unlocked!)\n' % _nice(t))
if state.stamped(t) == None:
err('%s: failed in another thread\n' % _nice(t))
retcode[0] = 2