Commit 5b69d553 authored by Julien Muchembled's avatar Julien Muchembled

Better output of verbose locks

- For all threads except the main one, the id is displayed instead of the name,
  because the latter is not always unique.
- Outputs may be interlaced by concurrent thread, so tracebacks are also
  prefixed by their idents.
parent ede173f8
......@@ -30,7 +30,10 @@ import os
class LockUser(object):
def __init__(self, level=0):
self.ident = currentThread().getName()
t = currentThread()
self.ident = t.getName()
if self.ident != 'MainThread':
self.ident = t.ident
# This class is instanciated from a place desiring to known what
# called it.
# limit=1 would return execution position in this method
......@@ -88,8 +91,8 @@ class VerboseLockBase(object):
else:
self._note('[%r]%s.acquire(%s): debug lock triggered: %r',
me, self, blocking, owner)
self._note('Owner traceback:\n%s', owner.formatStack())
self._note('My traceback:\n%s', me.formatStack())
self._note('[%r] Owner traceback:\n%s', me, owner.formatStack())
self._note('[%r] My traceback:\n%s', me, me.formatStack())
if blocking:
self.waiting.append(me)
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment