diff options
Diffstat (limited to 'ace/Asynch_IO.h')
-rw-r--r-- | ace/Asynch_IO.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h index 8af31d3e167..4ae52ea7c3c 100644 --- a/ace/Asynch_IO.h +++ b/ace/Asynch_IO.h @@ -35,6 +35,14 @@ #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS)) +#include "ace/Synch_Traits.h" +#if defined (ACE_HAS_THREADS) +# include "ace/Thread_Mutex.h" +#else +# include "ace/Null_Mutex.h" +#endif /* ACE_HAS_THREADS */ +#include "ace/Refcounted_Auto_Ptr.h" + #include "ace/os_include/os_signal.h" #include "ace/os_include/sys/os_socket.h" #include "ace/os_include/sys/os_types.h" @@ -1550,12 +1558,38 @@ public: /// Set the ACE_HANDLE value for this Handler. virtual void handle (ACE_HANDLE); + /** + * @class Proxy + * + * @brief The Proxy class acts as a proxy for dispatch of completions + * to operations issued for the associated handler. It allows the handler + * to be deleted while operations are outstanding. The proxy must be used + * to get the ACE_Handler pointer for dispatching, and if it's 0, the + * handler is no longer valid and the result should not be dispatched. + */ + class ACE_Export Proxy + { + public: + Proxy (ACE_Handler *handler) : handler_ (handler) {}; + void reset (void) { this->handler_ = 0; }; + ACE_Handler *handler (void) { return this->handler_; }; + private: + ACE_Handler *handler_; + }; + typedef ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy,ACE_SYNCH_MUTEX> + Proxy_Ptr; + + ACE_Handler::Proxy_Ptr &proxy (void); + protected: /// The proactor associated with this handler. ACE_Proactor *proactor_; /// The ACE_HANDLE in use with this handler. ACE_HANDLE handle_; + + /// Refers to proxy for this handler. + ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy, ACE_SYNCH_MUTEX> proxy_; }; // Forward declarations |