// ********************************************************************** // // Copyright (c) 2003-2009 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 ICE_SELECTOR_THREAD_H #define ICE_SELECTOR_THREAD_H #include #include #include #include #include #include #include #include #include #include #include namespace IceInternal { class SelectorThread : public IceUtil::Shared, IceUtil::Mutex { public: SelectorThread(const InstancePtr&); virtual ~SelectorThread(); void destroy(); void incFdsInUse(); void decFdsInUse(); void _register(SOCKET, const SocketReadyCallbackPtr&, SocketStatus status, int timeout); void unregister(const SocketReadyCallbackPtr&); void finish(const SocketReadyCallbackPtr&); void joinWithThread(); private: void run(); class HelperThread : public IceUtil::Thread { public: HelperThread(const SelectorThreadPtr&); virtual void run(); private: SelectorThreadPtr _selectorThread; }; friend class HelperThread; InstancePtr _instance; bool _destroyed; Selector _selector; std::deque _finished; IceUtil::ThreadPtr _thread; IceUtil::TimerPtr _timer; }; } #endif