summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/EventHandler.h
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2009-08-21 15:55:01 +0200
committerBenoit Foucher <benoit@zeroc.com>2009-08-21 15:55:01 +0200
commitb9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a (patch)
tree183215e2dbeadfbc871b800ce09726e58af38b91 /cpp/src/Ice/EventHandler.h
parentadding compression cookbook demo (diff)
downloadice-b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a.tar.bz2
ice-b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a.tar.xz
ice-b9f2fa14fb3f222a6ec5e0a93bf25fe5ad12b56a.zip
IOCP changes, bug 3501, 4200, 4156, 3101
Diffstat (limited to 'cpp/src/Ice/EventHandler.h')
-rw-r--r--cpp/src/Ice/EventHandler.h79
1 files changed, 26 insertions, 53 deletions
diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h
index 2c3686fd54f..2b6073cc578 100644
--- a/cpp/src/Ice/EventHandler.h
+++ b/cpp/src/Ice/EventHandler.h
@@ -16,14 +16,6 @@
#include <Ice/ThreadPoolF.h>
#include <Ice/BasicStream.h>
#include <Ice/Network.h>
-#include <Ice/SelectorF.h>
-
-namespace Ice
-{
-
-class LocalException;
-
-}
namespace IceInternal
{
@@ -32,70 +24,51 @@ class EventHandler : virtual public ::IceUtil::Shared
{
public:
- InstancePtr instance() const;
-
+#ifdef ICE_USE_IOCP
//
- // Return true if the handler is for a datagram transport, false otherwise.
+ // Called to start a new asynchronous read or write operation.
//
- virtual bool datagram() const = 0;
-
- //
- // Return true if read() must be called before calling message().
- //
- virtual bool readable() const = 0;
-
- //
- // Read data via the event handler. May only be called if
- // readable() returns true.
- //
- virtual bool read(BasicStream&) = 0;
+ virtual bool startAsync(SocketOperation) = 0;
+ virtual bool finishAsync(SocketOperation) = 0;
+#endif
//
- // A complete message has been received.
+ // Called when there's a message ready to be processed.
//
- virtual void message(BasicStream&, const ThreadPoolPtr&) = 0;
+ virtual void message(ThreadPoolCurrent&) = 0;
//
- // Will be called if the event handler is finally
- // unregistered. (Calling unregister() does not unregister
- // immediately.)
+ // Called when the event handler is unregistered.
//
- virtual void finished(const ThreadPoolPtr&) = 0;
+ virtual void finished(ThreadPoolCurrent&) = 0;
//
- // Propagate an exception to the event handler.
+ // Get a textual representation of the event handler.
//
- virtual void exception(const ::Ice::LocalException&) = 0;
+ virtual std::string toString() const = 0;
//
- // Get a textual representation of the event handler.
+ // Get the native information of the handler, this is used by the selector.
//
- virtual std::string toString() const = 0;
+ virtual NativeInfoPtr getNativeInfo() = 0;
protected:
- EventHandler(const InstancePtr&, SOCKET = INVALID_SOCKET);
- ICE_API virtual ~EventHandler();
-
- const InstancePtr _instance;
+ EventHandler();
+ virtual ~EventHandler();
+
+#ifdef ICE_USE_IOCP
+ SocketOperation _ready;
+ SocketOperation _pending;
+ SocketOperation _started;
+ bool _finish;
+#else
+ SocketOperation _disabled;
+#endif
+ SocketOperation _registered;
- //
- // The _stream data member is for use by ThreadPool or by the
- // connection for connection validation only.
- //
- BasicStream _stream;
- SOCKET _fd;
- bool _serializing;
- bool _registered;
friend class ThreadPool;
- friend class Selector<EventHandler>;
-};
-
-class ThreadPoolWorkItem : virtual public IceUtil::Shared
-{
-public:
-
- virtual void execute(const ThreadPoolPtr&) = 0;
+ friend class Selector;
};
}