Commit c154e45a authored by Julien Muchembled's avatar Julien Muchembled

Work around potential deadlock when stopping threaded test

For example, with test2Clusters:

Traceback (most recent call last):
  File "neo/master/", line 111, in run
  File "neo/master/", line 131, in _run
  File "neo/master/", line 318, in playPrimaryRole
  File "neo/master/", line 269, in provideService
  File "neo/lib/", line 90, in poll
  File "neo/tests/threaded/", line 150, in _poll
  File "neo/tests/threaded/", line 102, in tic
    cls.release(lock); cls.acquire(lock)
  File "neo/tests/threaded/", line 88, in acquire
    elif threading.currentThread() in cls.pending:
TypeError: argument of type 'int' is not iterable
parent b80fc0c4
...@@ -82,10 +82,11 @@ class Serialized(object): ...@@ -82,10 +82,11 @@ class Serialized(object):
if lock is None: if lock is None:
lock = cls._global_lock lock = cls._global_lock
lock.acquire() lock.acquire()
if type(cls.pending) is frozenset: # XXX pending = cls.pending # XXX: getattr once to avoid race conditions
if type(pending) is frozenset: # XXX
if lock is cls._global_lock: if lock is cls._global_lock:
cls.pending = 0 cls.pending = 0
elif threading.currentThread() in cls.pending: elif threading.currentThread() in pending:
sys.exit() sys.exit()
if cls._pdb: if cls._pdb:
cls._pdb = False cls._pdb = False
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