diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-07-22 17:09:25 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-07-22 17:09:25 -0400 |
commit | 752e06b4eb63abb8a30bb958802eaedda72d3806 (patch) | |
tree | 7c2348544d202c310a55a62629abc4025daa03a5 /cpp/test/Ice/dispatcher/Dispatcher.h | |
parent | Disable VS 2015 update 3 optimizer (diff) | |
download | ice-752e06b4eb63abb8a30bb958802eaedda72d3806.tar.bz2 ice-752e06b4eb63abb8a30bb958802eaedda72d3806.tar.xz ice-752e06b4eb63abb8a30bb958802eaedda72d3806.zip |
Added ICE_BUILDING_SRC to make builds
Ice::Dispatcher and Ice::LocalObject are now hidden with C++11
Reworked C++11 exception ice_clone, added ExceptionHelper
+ other C++ cleanups
Diffstat (limited to 'cpp/test/Ice/dispatcher/Dispatcher.h')
-rw-r--r-- | cpp/test/Ice/dispatcher/Dispatcher.h | 39 |
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; }; |