summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/acm/TestI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/acm/TestI.cpp')
-rw-r--r--cpp/test/Ice/acm/TestI.cpp71
1 files changed, 36 insertions, 35 deletions
diff --git a/cpp/test/Ice/acm/TestI.cpp b/cpp/test/Ice/acm/TestI.cpp
index 869d204cf7e..493221b57a6 100644
--- a/cpp/test/Ice/acm/TestI.cpp
+++ b/cpp/test/Ice/acm/TestI.cpp
@@ -26,6 +26,40 @@ toString(int value)
return os.str();
}
+class ConnectionCallbackI : public Ice::ConnectionCallback, private IceUtil::Monitor<IceUtil::Mutex>
+{
+public:
+
+ void
+ waitForCount(int count)
+ {
+ Lock sync(*this);
+ _count = count;
+ while(_count > 0)
+ {
+ wait();
+ }
+ }
+
+private:
+
+ virtual void
+ heartbeat(const Ice::ConnectionPtr&)
+ {
+ Lock sync(*this);
+ --_count;
+ notifyAll();
+ }
+
+ virtual void
+ closed(const Ice::ConnectionPtr&)
+ {
+ }
+
+ int _count;
+};
+typedef IceUtil::Handle<ConnectionCallbackI> ConnectionCallbackIPtr;
+
}
RemoteObjectAdapterPrx
@@ -123,40 +157,7 @@ TestI::interruptSleep(const Ice::Current& current)
void
TestI::waitForHeartbeat(int count, const Ice::Current& current)
{
- class ConnectionCallbackI : public Ice::ConnectionCallback, private IceUtil::Monitor<IceUtil::Mutex>
- {
- public:
-
- void
- waitForCount(int count)
- {
- Lock sync(*this);
- _count = count;
- while(_count > 0)
- {
- wait();
- }
- }
-
- private:
-
- virtual void
- heartbeat(const Ice::ConnectionPtr&)
- {
- Lock sync(*this);
- --_count;
- notifyAll();
- }
-
- virtual void
- closed(const Ice::ConnectionPtr&)
- {
- }
-
- int _count;
- };
-
- IceUtil::Handle<ConnectionCallbackI> callback = new ConnectionCallbackI();
+ ConnectionCallbackIPtr callback = new ConnectionCallbackI();
current.con->setCallback(callback);
callback->waitForCount(count);
-} \ No newline at end of file
+}