summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/dispatcher/Dispatcher.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/dispatcher/Dispatcher.h')
-rw-r--r--cpp/test/Ice/dispatcher/Dispatcher.h39
1 files changed, 37 insertions, 2 deletions
diff --git a/cpp/test/Ice/dispatcher/Dispatcher.h b/cpp/test/Ice/dispatcher/Dispatcher.h
index 40236236356..b61b64f1dc3 100644
--- a/cpp/test/Ice/dispatcher/Dispatcher.h
+++ b/cpp/test/Ice/dispatcher/Dispatcher.h
@@ -14,17 +14,48 @@
#include <IceUtil/Monitor.h>
#include <IceUtil/Mutex.h>
#include <Ice/Dispatcher.h>
+#include <Ice/Connection.h>
#include <deque>
-class Dispatcher : public Ice::Dispatcher, IceUtil::Thread, IceUtil::Monitor<IceUtil::Mutex>
+#ifdef ICE_CPP11_MAPPING
+class DispatcherCall
+{
+public:
+
+ DispatcherCall(std::function<void()> call) :
+ _call(std::move(call))
+ {
+ }
+
+ void run()
+ {
+ _call();
+ }
+
+private:
+
+ std::function<void()> _call;
+};
+#endif
+
+class Dispatcher :
+#ifndef ICE_CPP11_MAPPING
+ public Ice::Dispatcher,
+#endif
+public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
{
public:
Dispatcher();
+
+#ifdef ICE_CPP11_MAPPING
+ void dispatch(const std::shared_ptr<DispatcherCall>&, const std::shared_ptr<Ice::Connection>&);
+#else
virtual void dispatch(const Ice::DispatcherCallPtr&, const Ice::ConnectionPtr&);
+#endif
+
-
void run();
static void terminate();
static bool isDispatcherThread();
@@ -32,7 +63,11 @@ public:
private:
static Dispatcher* _instance;
+#ifdef ICE_CPP11_MAPPING
+ std::deque<std::shared_ptr<DispatcherCall>> _calls;
+#else
std::deque<Ice::DispatcherCallPtr> _calls;
+#endif
bool _terminated;
};