summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/acm/TestI.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2017-01-30 13:45:21 -0800
committerMark Spruiell <mes@zeroc.com>2017-01-30 13:45:21 -0800
commit61270a10f980933cf582edb766f10c8ac6d86e8a (patch)
tree45ab4a7c2986954054fce613bc3c8f7967e7951e /cpp/test/Ice/acm/TestI.cpp
parentFix slice2cpp build failure (diff)
downloadice-61270a10f980933cf582edb766f10c8ac6d86e8a.tar.bz2
ice-61270a10f980933cf582edb766f10c8ac6d86e8a.tar.xz
ice-61270a10f980933cf582edb766f10c8ac6d86e8a.zip
merging IceBridge into master
Diffstat (limited to 'cpp/test/Ice/acm/TestI.cpp')
-rw-r--r--cpp/test/Ice/acm/TestI.cpp50
1 files changed, 11 insertions, 39 deletions
diff --git a/cpp/test/Ice/acm/TestI.cpp b/cpp/test/Ice/acm/TestI.cpp
index d7742680a70..f4987856421 100644
--- a/cpp/test/Ice/acm/TestI.cpp
+++ b/cpp/test/Ice/acm/TestI.cpp
@@ -26,41 +26,6 @@ toString(int value)
return os.str();
}
-class HeartbeatCallbackI :
-#ifdef ICE_CPP11_MAPPING
- public enable_shared_from_this<HeartbeatCallbackI>,
-#else
- public Ice::HeartbeatCallback,
-#endif
- private IceUtil::Monitor<IceUtil::Mutex>
-{
-public:
-
- void
- waitForCount(int count)
- {
- Lock sync(*this);
- _count = count;
- while(_count > 0)
- {
- wait();
- }
- }
-
- virtual void
- heartbeat(const Ice::ConnectionPtr&)
- {
- Lock sync(*this);
- --_count;
- notifyAll();
- }
-
-private:
-
- int _count;
-};
-ICE_DEFINE_PTR(HeartbeatCallbackIPtr, HeartbeatCallbackI);
-
}
RemoteObjectAdapterPrxPtr
@@ -162,16 +127,23 @@ TestI::interruptSleep(const Ice::Current& current)
}
void
-TestI::waitForHeartbeat(int count, const Ice::Current& current)
+TestI::startHeartbeatCount(const Ice::Current& current)
{
- HeartbeatCallbackIPtr callback = ICE_MAKE_SHARED(HeartbeatCallbackI);
+ _callback = ICE_MAKE_SHARED(HeartbeatCallbackI);
#ifdef ICE_CPP11_MAPPING
+ HeartbeatCallbackIPtr callback = _callback;
current.con->setHeartbeatCallback([callback](Ice::ConnectionPtr connection)
{
callback->heartbeat(move(connection));
});
#else
- current.con->setHeartbeatCallback(callback);
+ current.con->setHeartbeatCallback(_callback);
#endif
- callback->waitForCount(count);
+}
+
+void
+TestI::waitForHeartbeatCount(int count, const Ice::Current&)
+{
+ assert(_callback);
+ _callback->waitForCount(count);
}