builder,jwack: slight cleanup to token passing.

In rare cases, one process could end up holding onto more than one token.
This commit is contained in:
Avery Pennarun 2010-11-21 22:46:20 -08:00
commit 7aa7c41e38
3 changed files with 28 additions and 8 deletions

View file

@ -162,6 +162,12 @@ class Lock:
else:
raise
def waitlock(self):
while not self.owned:
self.wait()
self.trylock()
assert(self.owned)
def unlock(self):
if not self.owned:
raise Exception("can't unlock %r - we don't own it"