summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2011-03-17 20:03:20 +0000
committerAlan Conway <aconway@apache.org>2011-03-17 20:03:20 +0000
commite92294fca79d1b6a61cb343160ef39b076b66b03 (patch)
tree104623b8a79db89d443d1f433509fd7dba7ddc18 /qpid/cpp/src
parent870e17065214e27452ae38a6f3ae74cfe5df8f8a (diff)
downloadqpid-python-e92294fca79d1b6a61cb343160ef39b076b66b03.tar.gz
NO-JIRA: Put a timeout on calls to Thread.join to avoid tests hanging indefinitely.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1082668 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/tests/brokertest.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/qpid/cpp/src/tests/brokertest.py b/qpid/cpp/src/tests/brokertest.py
index 5a20dceae4..1023f7152f 100644
--- a/qpid/cpp/src/tests/brokertest.py
+++ b/qpid/cpp/src/tests/brokertest.py
@@ -498,6 +498,10 @@ class BrokerTest(TestCase):
r.close()
self.assertEqual(expect_contents, actual_contents)
+def join(thread, timeout=1):
+ thread.join(timeout)
+ if thread.isAlive(): raise Exception("Timed out joining thread %s"%thread)
+
class RethrownException(Exception):
"""Captures the stack trace of the current exception to be thrown later"""
def __init__(self, msg=""):
@@ -515,7 +519,7 @@ class StoppableThread(Thread):
def stop(self):
self.stopped = True
- self.join()
+ join(self)
if self.error: raise self.error
class NumberedSender(Thread):
@@ -574,7 +578,7 @@ class NumberedSender(Thread):
self.stopped = True
self.condition.notify()
finally: self.condition.release()
- self.join()
+ join(self)
self.write_message(-1) # end-of-messages marker.
if self.error: raise self.error
@@ -621,7 +625,7 @@ class NumberedReceiver(Thread):
def stop(self):
"""Returns when termination message is received"""
- self.join()
+ join(self)
if self.error: raise self.error
class ErrorGenerator(StoppableThread):