diff options
Diffstat (limited to 'cpp/src/Ice/ThreadPool.h')
-rw-r--r-- | cpp/src/Ice/ThreadPool.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h index 51d4eb55af9..9b7863643e2 100644 --- a/cpp/src/Ice/ThreadPool.h +++ b/cpp/src/Ice/ThreadPool.h @@ -20,11 +20,12 @@ #include <Ice/InstanceF.h> #include <Ice/LoggerF.h> #include <Ice/PropertiesF.h> -#include <Ice/EventHandlerF.h> +#include <Ice/EventHandler.h> #include <Ice/Selector.h> #include <Ice/BasicStream.h> #include <set> +#include <list> namespace IceInternal { @@ -161,6 +162,42 @@ public: virtual void execute(ThreadPoolCurrent&) = 0; }; +class ThreadPoolWorkQueue : public EventHandler, public IceUtil::Mutex +{ +public: + + ThreadPoolWorkQueue(ThreadPool*, const InstancePtr&, Selector&); + ~ThreadPoolWorkQueue(); + + void destroy(); + void queue(const ThreadPoolWorkItemPtr&); + +#ifdef ICE_USE_IOCP + bool startAsync(SocketOperation); + bool finishAsync(SocketOperation); +#endif + + virtual void message(ThreadPoolCurrent&); + virtual void finished(ThreadPoolCurrent&); + virtual std::string toString() const; + virtual NativeInfoPtr getNativeInfo(); + virtual void postMessage(); + +private: + + const ThreadPool* _threadPool; + const InstancePtr _instance; + Selector& _selector; + bool _destroyed; +#ifdef ICE_USE_IOCP + AsyncInfo _info; +#else + SOCKET _fdIntrRead; + SOCKET _fdIntrWrite; +#endif + std::list<ThreadPoolWorkItemPtr> _workItems; +}; + // // The ThreadPoolMessage class below hides the IOCP implementation details from // the event handler implementations. Only event handler implementation that |