summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/ThreadPool.h')
-rw-r--r--cpp/src/Ice/ThreadPool.h48
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: