diff options
Diffstat (limited to 'python/test/Ice/acm/TestI.py')
-rw-r--r-- | python/test/Ice/acm/TestI.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/python/test/Ice/acm/TestI.py b/python/test/Ice/acm/TestI.py index 6b63fd26d07..024899b8640 100644 --- a/python/test/Ice/acm/TestI.py +++ b/python/test/Ice/acm/TestI.py @@ -76,3 +76,36 @@ class TestIntfI(Test.TestIntf): self.m.notifyAll() finally: self.m.release() + + def waitForHeartbeat(self, count, current=None): + + class ConnectionCallbackI(Ice.ConnectionCallback): + + def __init__(self): + self.m = threading.Condition() + self.count = 0 + + def heartbeat(self, con): + self.m.acquire() + try: + self.count -= 1 + self.m.notifyAll() + finally: + self.m.release() + + def closed(self, con): + pass + + def waitForCount(self, count): + self.m.acquire() + self.count = count + try: + while self.count > 0: + self.m.wait() + finally: + self.m.release() + + callback = ConnectionCallbackI() + current.con.setCallback(callback) + callback.waitForCount(2) + |