// ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #ifndef DISPATCHER_I_H #define DISPATCHER_I_H #include #include #include #include #include #include #ifdef ICE_CPP11_MAPPING class DispatcherCall { public: DispatcherCall(std::function call) : _call(std::move(call)) { } void run() { _call(); } private: std::function _call; }; #endif class Dispatcher : #ifndef ICE_CPP11_MAPPING public Ice::Dispatcher, #endif public IceUtil::Thread, public IceUtil::Monitor { public: Dispatcher(); #ifdef ICE_CPP11_MAPPING void dispatch(const std::shared_ptr&, const std::shared_ptr&); #else virtual void dispatch(const Ice::DispatcherCallPtr&, const Ice::ConnectionPtr&); #endif void run(); static void terminate(); static bool isDispatcherThread(); private: static IceUtil::Handle _instance; #ifdef ICE_CPP11_MAPPING std::deque> _calls; #else std::deque _calls; #endif bool _terminated; }; #endif