diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-11-27 11:58:35 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-11-27 11:58:35 +0100 |
commit | 47f800495093fd7679a315e2d730fea22f6135b7 (patch) | |
tree | a7b8d3488f3841367dd03d10cae293f36fd10481 /cpp/src/Ice/ThreadPool.h | |
parent | Fixed SystemException to no longer derive from LocalException (diff) | |
download | ice-47f800495093fd7679a315e2d730fea22f6135b7.tar.bz2 ice-47f800495093fd7679a315e2d730fea22f6135b7.tar.xz ice-47f800495093fd7679a315e2d730fea22f6135b7.zip |
- Added support for non-blocking AMI/batch requests, connection
creation.
- Added support for AMI oneway requests.
- Changed collocation optimization to not perform any DNS lookups.
Diffstat (limited to 'cpp/src/Ice/ThreadPool.h')
-rw-r--r-- | cpp/src/Ice/ThreadPool.h | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h index 7f7aae48e19..9e520d60ec9 100644 --- a/cpp/src/Ice/ThreadPool.h +++ b/cpp/src/Ice/ThreadPool.h @@ -15,31 +15,15 @@ #include <IceUtil/Monitor.h> #include <IceUtil/Thread.h> +#include <Ice/Config.h> #include <Ice/ThreadPoolF.h> #include <Ice/InstanceF.h> #include <Ice/LoggerF.h> #include <Ice/PropertiesF.h> #include <Ice/EventHandlerF.h> +#include <Ice/Selector.h> #include <list> -#if defined(__linux) && !defined(ICE_NO_EPOLL) -# define ICE_USE_EPOLL 1 -#endif - -#if defined(_WIN32) -# include <winsock2.h> -#else -# define SOCKET int -# if defined(ICE_USE_EPOLL) -# include <sys/epoll.h> -# elif defined(__APPLE__) -# include <sys/event.h> -# else -# include <sys/poll.h> -# endif -#endif - - namespace IceInternal { @@ -59,6 +43,7 @@ public: void _register(SOCKET, const EventHandlerPtr&); void unregister(SOCKET); + void execute(const ThreadPoolWorkItemPtr&); void promoteFollower(); void joinWithAllThreads(); @@ -66,40 +51,19 @@ public: private: - void clearInterrupt(); - void setInterrupt(); - bool run(); // Returns true if a follower should be promoted. - void read(const EventHandlerPtr&); + bool read(const EventHandlerPtr&); InstancePtr _instance; bool _destroyed; const std::string _prefix; - SOCKET _maxFd; - SOCKET _minFd; - SOCKET _lastFd; - SOCKET _fdIntrRead; - SOCKET _fdIntrWrite; -#if defined(_WIN32) - fd_set _fdSet; - int _fdsInUse; -#elif defined(ICE_USE_EPOLL) - int _epollFd; - std::vector<struct epoll_event> _events; -#elif defined(__APPLE__) - int _kqueueFd; - std::vector<struct kevent> _events; -#else - std::vector<struct pollfd> _pollFdSet; -#endif + Selector _selector; std::list<std::pair<SOCKET, EventHandlerPtr> > _changes; // Event handler set for addition; null for removal. - + std::list<ThreadPoolWorkItemPtr> _workItems; std::map<SOCKET, EventHandlerPtr> _handlerMap; - int _timeout; - class EventHandlerThread : public IceUtil::Thread { public: |