summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/acm/TestI.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/acm/TestI.h')
-rw-r--r--cpp/test/Ice/acm/TestI.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/cpp/test/Ice/acm/TestI.h b/cpp/test/Ice/acm/TestI.h
index be031e3799d..c45415022a6 100644
--- a/cpp/test/Ice/acm/TestI.h
+++ b/cpp/test/Ice/acm/TestI.h
@@ -44,7 +44,51 @@ public:
virtual void sleep(int, const Ice::Current&);
virtual void sleepAndHold(int, const Ice::Current&);
virtual void interruptSleep(const Ice::Current&);
- virtual void waitForHeartbeat(int, const Ice::Current&);
+ virtual void startHeartbeatCount(const Ice::Current&);
+ virtual void waitForHeartbeatCount(int, const Ice::Current&);
+
+private:
+
+ class HeartbeatCallbackI :
+#ifdef ICE_CPP11_MAPPING
+ public std::enable_shared_from_this<HeartbeatCallbackI>,
+#else
+ public Ice::HeartbeatCallback,
+#endif
+ private IceUtil::Monitor<IceUtil::Mutex>
+ {
+ public:
+
+ HeartbeatCallbackI() :
+ _count(0)
+ {
+ }
+
+ void
+ waitForCount(int count)
+ {
+ Lock sync(*this);
+ while(_count < count)
+ {
+ wait();
+ }
+ }
+
+ virtual void
+ heartbeat(const Ice::ConnectionPtr&)
+ {
+ Lock sync(*this);
+ ++_count;
+ notifyAll();
+ }
+
+ private:
+
+ int _count;
+ };
+ ICE_DEFINE_PTR(HeartbeatCallbackIPtr, HeartbeatCallbackI);
+
+ HeartbeatCallbackIPtr _callback;
};
#endif