diff options
author | Steve Huston <shuston@riverace.com> | 2005-02-15 23:28:24 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2005-02-15 23:28:24 +0000 |
commit | ccdffbe11990510ebfe9f54164181a5162a78022 (patch) | |
tree | e84490c9977291aa67d73b429e4448702cfbc1de /ace | |
parent | ab9d677be93a7696a974203915e80c88669536da (diff) | |
download | ATCD-ccdffbe11990510ebfe9f54164181a5162a78022.tar.gz |
ChangeLogTag:Tue Feb 15 18:19:25 2005 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Asynch_IO.cpp | 19 | ||||
-rw-r--r-- | ace/Asynch_IO.h | 34 | ||||
-rw-r--r-- | ace/Asynch_IO_Impl.h | 6 | ||||
-rw-r--r-- | ace/OS_NS_stdlib.cpp | 2 | ||||
-rw-r--r-- | ace/POSIX_Asynch_IO.cpp | 168 | ||||
-rw-r--r-- | ace/POSIX_Asynch_IO.h | 30 | ||||
-rw-r--r-- | ace/POSIX_Proactor.cpp | 275 | ||||
-rw-r--r-- | ace/POSIX_Proactor.h | 35 | ||||
-rw-r--r-- | ace/Proactor.cpp | 404 | ||||
-rw-r--r-- | ace/Proactor.h | 31 | ||||
-rw-r--r-- | ace/Proactor_Impl.h | 188 | ||||
-rw-r--r-- | ace/WIN32_Asynch_IO.cpp | 166 | ||||
-rw-r--r-- | ace/WIN32_Asynch_IO.h | 46 | ||||
-rw-r--r-- | ace/WIN32_Proactor.cpp | 262 | ||||
-rw-r--r-- | ace/WIN32_Proactor.h | 22 | ||||
-rw-r--r-- | ace/config-win32-common.h | 6 |
16 files changed, 927 insertions, 767 deletions
diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp index 93d33c6f6ca..7b652ca0525 100644 --- a/ace/Asynch_IO.cpp +++ b/ace/Asynch_IO.cpp @@ -96,7 +96,7 @@ ACE_Asynch_Operation::open (ACE_Handler &handler, const void *completion_key, ACE_Proactor *proactor) { - return this->implementation ()->open (handler, + return this->implementation ()->open (handler.proxy (), handle, completion_key, proactor); @@ -182,7 +182,7 @@ ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block, bytes_to_read, act, priority, - signal_number); + signal_number); } #if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) @@ -985,15 +985,24 @@ ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void) ACE_Handler::ACE_Handler (void) : proactor_ (0), handle_ (ACE_INVALID_HANDLE) { + ACE_Handler::Proxy *p; + ACE_NEW (p, ACE_Handler::Proxy (this)); + this->proxy_.reset (p); } ACE_Handler::ACE_Handler (ACE_Proactor *d) : proactor_ (d), handle_ (ACE_INVALID_HANDLE) { + ACE_Handler::Proxy *p; + ACE_NEW (p, ACE_Handler::Proxy (this)); + this->proxy_.reset (p); } ACE_Handler::~ACE_Handler (void) { + ACE_Handler::Proxy *p = this->proxy_.get (); + if (p) + p->reset (); } void @@ -1076,6 +1085,12 @@ ACE_Handler::handle (ACE_HANDLE h) this->handle_ = h; } +ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy, ACE_SYNCH_MUTEX> & +ACE_Handler::proxy (void) +{ + return this->proxy_; +} + // ************************************************************ ACE_Service_Handler::ACE_Service_Handler (void) diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h index f091e4332d3..035c4bb01dd 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 diff --git a/ace/Asynch_IO_Impl.h b/ace/Asynch_IO_Impl.h index c1ad52825b6..5657c2c49dc 100644 --- a/ace/Asynch_IO_Impl.h +++ b/ace/Asynch_IO_Impl.h @@ -117,11 +117,11 @@ public: /** * Initializes the factory with information which will be used with - * each asynchronous call. If (<handle> == ACE_INVALID_HANDLE), - * <ACE_Handler::handle> will be called on the <handler> to get the + * each asynchronous call. If @a handle == ACE_INVALID_HANDLE, + * ACE_Handler::handle() will be called on the proxied handler to get the * correct handle. */ - virtual int open (ACE_Handler &handler, + virtual int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) = 0; diff --git a/ace/OS_NS_stdlib.cpp b/ace/OS_NS_stdlib.cpp index 66262cf2088..de0c9c305b0 100644 --- a/ace/OS_NS_stdlib.cpp +++ b/ace/OS_NS_stdlib.cpp @@ -622,7 +622,7 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s) // greatly slowing down this mkstemp() implementation. It is more // practical to limit the search space to UTF-8 / ASCII characters // (i.e. 127 characters). -# if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS) +# if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS) || defined (max) static float const MAX_VAL = static_cast<float> (127); #else static float const MAX_VAL = diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp index 900364ff095..0dccaad9210 100644 --- a/ace/POSIX_Asynch_IO.cpp +++ b/ace/POSIX_Asynch_IO.cpp @@ -109,16 +109,17 @@ ACE_POSIX_Asynch_Result::~ACE_POSIX_Asynch_Result (void) { } -ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result (ACE_Handler &handler, - const void* act, - ACE_HANDLE event, - u_long offset, - u_long offset_high, - int priority, - int signal_number) +ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void* act, + ACE_HANDLE event, + u_long offset, + u_long offset_high, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), aiocb (), - handler_ (handler), + handler_proxy_ (handler_proxy), act_ (act), bytes_transferred_ (0), success_ (0), @@ -144,18 +145,22 @@ ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result (ACE_Handler &handler, // **************************************************************** int -ACE_POSIX_Asynch_Operation::open (ACE_Handler &handler, +ACE_POSIX_Asynch_Operation::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { this->proactor_ = proactor; - this->handler_ = &handler; + this->handler_proxy_ = handler_proxy; this->handle_ = handle; // Grab the handle from the <handler> if <handle> is invalid if (this->handle_ == ACE_INVALID_HANDLE) - this->handle_ = this->handler_->handle (); + { + ACE_Handler *handler = handler_proxy.get ()->handler (); + if (handler != 0) + this->handle_ = handler->handle (); + } if (this->handle_ == ACE_INVALID_HANDLE) return -1; @@ -207,7 +212,6 @@ ACE_POSIX_Asynch_Operation::~ACE_POSIX_Asynch_Operation (void) ACE_POSIX_Asynch_Operation::ACE_POSIX_Asynch_Operation (ACE_POSIX_Proactor *posix_proactor) : ACE_Asynch_Operation_Impl (), posix_proactor_ (posix_proactor), - handler_ (0), handle_ (ACE_INVALID_HANDLE) { } @@ -232,17 +236,19 @@ ACE_POSIX_Asynch_Read_Stream_Result::handle (void) const return this->aio_fildes; } -ACE_POSIX_Asynch_Read_Stream_Result::ACE_POSIX_Asynch_Read_Stream_Result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Asynch_Read_Stream_Result::ACE_POSIX_Asynch_Read_Stream_Result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Read_Stream_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block) { this->aio_fildes = handle; @@ -272,7 +278,9 @@ ACE_POSIX_Asynch_Read_Stream_Result::complete (size_t bytes_transferred, ACE_Asynch_Read_Stream::Result result (this); // Call the application handler. - this->handler_.handle_read_stream (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_stream (result); } ACE_POSIX_Asynch_Read_Stream_Result::~ACE_POSIX_Asynch_Read_Stream_Result (void) @@ -309,7 +317,7 @@ ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block, ACE_POSIX_Asynch_Read_Stream_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Read_Stream_Result (*this->handler_, + ACE_POSIX_Asynch_Read_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -351,7 +359,7 @@ ACE_POSIX_Asynch_Write_Stream_Result::handle (void) const } ACE_POSIX_Asynch_Write_Stream_Result::ACE_POSIX_Asynch_Write_Stream_Result - (ACE_Handler &handler, + (ACE_Handler::Procy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -361,7 +369,8 @@ ACE_POSIX_Asynch_Write_Stream_Result::ACE_POSIX_Asynch_Write_Stream_Result int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Write_Stream_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block) { this->aio_fildes = handle; @@ -392,7 +401,9 @@ ACE_POSIX_Asynch_Write_Stream_Result::complete (size_t bytes_transferred, ACE_Asynch_Write_Stream::Result result (this); // Call the application handler. - this->handler_.handle_write_stream (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_stream (result); } ACE_POSIX_Asynch_Write_Stream_Result::~ACE_POSIX_Asynch_Write_Stream_Result (void) @@ -429,7 +440,7 @@ ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block, ACE_POSIX_Asynch_Write_Stream_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Write_Stream_Result (*this->handler_, + ACE_POSIX_Asynch_Write_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -453,7 +464,7 @@ ACE_POSIX_Asynch_Write_Stream::~ACE_POSIX_Asynch_Write_Stream (void) // ********************************************************************* ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -466,7 +477,7 @@ ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Read_Stream_Result_Impl (), ACE_Asynch_Read_File_Result_Impl (), - ACE_POSIX_Asynch_Read_Stream_Result (handler, + ACE_POSIX_Asynch_Read_Stream_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -504,7 +515,9 @@ ACE_POSIX_Asynch_Read_File_Result::complete (size_t bytes_transferred, ACE_Asynch_Read_File::Result result (this); // Call the application handler. - this->handler_.handle_read_file (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_file (result); } ACE_POSIX_Asynch_Read_File_Result::~ACE_POSIX_Asynch_Read_File_Result (void) @@ -544,7 +557,7 @@ ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block, ACE_POSIX_Asynch_Read_File_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Read_File_Result (*this->handler_, + ACE_POSIX_Asynch_Read_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -575,16 +588,16 @@ ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block, int signal_number) { return ACE_POSIX_Asynch_Read_Stream::read (message_block, - bytes_to_read, - act, - priority, - signal_number); + bytes_to_read, + act, + priority, + signal_number); } // ************************************************************ ACE_POSIX_Asynch_Write_File_Result::ACE_POSIX_Asynch_Write_File_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -597,7 +610,7 @@ ACE_POSIX_Asynch_Write_File_Result::ACE_POSIX_Asynch_Write_File_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Write_Stream_Result_Impl (), ACE_Asynch_Write_File_Result_Impl (), - ACE_POSIX_Asynch_Write_Stream_Result (handler, + ACE_POSIX_Asynch_Write_Stream_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -635,7 +648,9 @@ ACE_POSIX_Asynch_Write_File_Result::complete (size_t bytes_transferred, ACE_Asynch_Write_File::Result result (this); // Call the application handler. - this->handler_.handle_write_file (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_file (result); } ACE_POSIX_Asynch_Write_File_Result::~ACE_POSIX_Asynch_Write_File_Result (void) @@ -675,7 +690,7 @@ ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block, ACE_POSIX_Asynch_Write_File_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Write_File_Result (*this->handler_, + ACE_POSIX_Asynch_Write_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -740,7 +755,7 @@ ACE_POSIX_Asynch_Accept_Result::accept_handle (void) const } ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -752,7 +767,8 @@ ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Accept_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block), listen_handle_ (listen_handle) { @@ -779,7 +795,9 @@ ACE_POSIX_Asynch_Accept_Result::complete (size_t bytes_transferred, ACE_Asynch_Accept::Result result (this); // Call the application handler. - this->handler_.handle_accept (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_accept (result); } ACE_POSIX_Asynch_Accept_Result::~ACE_POSIX_Asynch_Accept_Result (void) @@ -817,7 +835,7 @@ ACE_POSIX_Asynch_Accept::set_handle (ACE_HANDLE handle) } int -ACE_POSIX_Asynch_Accept::open (ACE_Handler &handler, +ACE_POSIX_Asynch_Accept::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) @@ -837,7 +855,7 @@ ACE_POSIX_Asynch_Accept::open (ACE_Handler &handler, ACE_LIB_TEXT("acceptor already open \n")), -1); - result = ACE_POSIX_Asynch_Operation::open (handler, + result = ACE_POSIX_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -908,7 +926,7 @@ ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block, // Create future Asynch_Accept_Result ACE_POSIX_Asynch_Accept_Result *result = 0; ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Accept_Result (*this->handler_, + ACE_POSIX_Asynch_Accept_Result (this->handler_proxy_, this->handle_, accept_handle, message_block, @@ -1232,7 +1250,7 @@ void ACE_POSIX_Asynch_Connect_Result::connect_handle (ACE_HANDLE handle) ACE_POSIX_Asynch_Connect_Result::ACE_POSIX_Asynch_Connect_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, ACE_HANDLE event, @@ -1241,7 +1259,8 @@ ACE_POSIX_Asynch_Connect_Result::ACE_POSIX_Asynch_Connect_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Connect_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number) + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number) { this->aio_fildes = connect_handle; this->aio_nbytes = 0; @@ -1263,7 +1282,9 @@ ACE_POSIX_Asynch_Connect_Result::complete (size_t bytes_transferred, ACE_Asynch_Connect::Result result (this); // Call the application handler. - this->handler_.handle_connect (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_connect (result); } ACE_POSIX_Asynch_Connect_Result::~ACE_POSIX_Asynch_Connect_Result (void) @@ -1302,7 +1323,7 @@ ACE_POSIX_Asynch_Connect::set_handle (ACE_HANDLE) } int -ACE_POSIX_Asynch_Connect::open (ACE_Handler &handler, +ACE_POSIX_Asynch_Connect::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) @@ -1321,7 +1342,7 @@ ACE_POSIX_Asynch_Connect::open (ACE_Handler &handler, -1); //int result = - ACE_POSIX_Asynch_Operation::open (handler, + ACE_POSIX_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -1359,13 +1380,13 @@ ACE_POSIX_Asynch_Connect::connect (ACE_HANDLE connect_handle, // Create future Asynch_Connect_Result ACE_POSIX_Asynch_Connect_Result *result = 0; ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Connect_Result (*this->handler_, - connect_handle, - act, - this->posix_proactor ()->get_handle (), - priority, - signal_number), - -1); + ACE_POSIX_Asynch_Connect_Result (this->handler_proxy_, + connect_handle, + act, + this->posix_proactor ()->get_handle (), + priority, + signal_number), + -1); int rc = connect_i (result, remote_sap, @@ -1823,7 +1844,7 @@ ACE_POSIX_Asynch_Transmit_File_Result::flags (void) const } ACE_POSIX_Asynch_Transmit_File_Result::ACE_POSIX_Asynch_Transmit_File_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -1839,7 +1860,8 @@ ACE_POSIX_Asynch_Transmit_File_Result::ACE_POSIX_Asynch_Transmit_File_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Transmit_File_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, offset, offset_high, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, offset, offset_high, priority, signal_number), socket_ (socket), header_and_trailer_ (header_and_trailer), bytes_per_send_ (bytes_per_send), @@ -1881,7 +1903,9 @@ ACE_POSIX_Asynch_Transmit_File_Result::complete (size_t bytes_transferred, ACE_Asynch_Transmit_File::Result result (this); // Call the application handler. - this->handler_.handle_transmit_file (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_transmit_file (result); } ACE_POSIX_Asynch_Transmit_File_Result::~ACE_POSIX_Asynch_Transmit_File_Result (void) @@ -2269,7 +2293,7 @@ ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, ACE_POSIX_Asynch_Transmit_File_Result *result = 0; ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Transmit_File_Result (*this->handler_, + ACE_POSIX_Asynch_Transmit_File_Result (this->handler_proxy_, this->handle_, file, header_and_trailer, @@ -2354,7 +2378,7 @@ ACE_POSIX_Asynch_Read_Dgram_Result::message_block () const } ACE_POSIX_Asynch_Read_Dgram_Result::ACE_POSIX_Asynch_Read_Dgram_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, @@ -2367,7 +2391,8 @@ ACE_POSIX_Asynch_Read_Dgram_Result::ACE_POSIX_Asynch_Read_Dgram_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Read_Dgram_Result_Impl(), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_read_ (bytes_to_read), message_block_ (message_block), remote_address_ (0), @@ -2402,7 +2427,9 @@ ACE_POSIX_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred, ACE_Asynch_Read_Dgram::Result result (this); // Call the application handler. - this->handler_.handle_read_dgram (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_dgram (result); } ACE_POSIX_Asynch_Read_Dgram_Result::~ACE_POSIX_Asynch_Read_Dgram_Result (void) @@ -2437,7 +2464,7 @@ ACE_POSIX_Asynch_Write_Dgram_Result::message_block () const } ACE_POSIX_Asynch_Write_Dgram_Result::ACE_POSIX_Asynch_Write_Dgram_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -2449,7 +2476,8 @@ ACE_POSIX_Asynch_Write_Dgram_Result::ACE_POSIX_Asynch_Write_Dgram_Result : ACE_Asynch_Result_Impl (), ACE_Asynch_Write_Dgram_Result_Impl(), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_write_ (bytes_to_write), message_block_ (message_block), flags_ (flags), @@ -2482,7 +2510,9 @@ ACE_POSIX_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred, ACE_Asynch_Write_Dgram::Result result (this); // Call the application handler. - this->handler_.handle_write_dgram (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_dgram (result); } ACE_POSIX_Asynch_Write_Dgram_Result::~ACE_POSIX_Asynch_Write_Dgram_Result (void) @@ -2508,7 +2538,7 @@ ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, ACE_POSIX_Asynch_Read_Dgram_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Read_Dgram_Result (*this->handler_, + ACE_POSIX_Asynch_Read_Dgram_Result (this->handler_proxy_, this->handle_, message_block, space, @@ -2560,7 +2590,7 @@ ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, ACE_POSIX_Asynch_Write_Dgram_Result *result = 0; ACE_POSIX_Proactor *proactor = this->posix_proactor (); ACE_NEW_RETURN (result, - ACE_POSIX_Asynch_Write_Dgram_Result (*this->handler_, + ACE_POSIX_Asynch_Write_Dgram_Result (this->handler_proxy_, this->handle_, message_block, len, diff --git a/ace/POSIX_Asynch_IO.h b/ace/POSIX_Asynch_IO.h index dae1bb2b359..2a40c48c688 100644 --- a/ace/POSIX_Asynch_IO.h +++ b/ace/POSIX_Asynch_IO.h @@ -114,7 +114,7 @@ public: protected: /// Constructor. <Event> is not used on POSIX. - ACE_POSIX_Asynch_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Result (ACE_Handler::Proxy_Ptr &handler_proxy, const void* act, ACE_HANDLE event, u_long offset, @@ -123,7 +123,7 @@ protected: int signal_number); /// Handler that will be called back. - ACE_Handler &handler_; + ACE_Handler::Proxy_Ptr &handler_proxy_; /** * ACT for this operation. @@ -166,7 +166,7 @@ public: * Operation class itself was created by the correct implementation * Proactor class. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor = 0); @@ -209,7 +209,7 @@ protected: ACE_Proactor *proactor_; /// Handler that will receive the callback. - ACE_Handler *handler_; + ACE_Handler::Proxy_Ptr *handler_proxy_; /// I/O handle used for reading. ACE_HANDLE handle_; @@ -243,7 +243,7 @@ public: ACE_HANDLE handle (void) const; protected: - ACE_POSIX_Asynch_Read_Stream_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Read_Stream_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -335,7 +335,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Write_Stream factory. - ACE_POSIX_Asynch_Write_Stream_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Write_Stream_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -410,7 +410,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Read_File factory. - ACE_POSIX_Asynch_Read_File_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Read_File_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -514,7 +514,7 @@ class ACE_Export ACE_POSIX_Asynch_Write_File_Result : public virtual ACE_Asynch_ protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Write_File factory. - ACE_POSIX_Asynch_Write_File_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Write_File_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -618,7 +618,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Accept factory. - ACE_POSIX_Asynch_Accept_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Accept_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -676,7 +676,7 @@ public: * this call to that method. We have put this here to avoid the * compiler warnings. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor = 0); @@ -784,7 +784,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Connect factory. - ACE_POSIX_Asynch_Connect_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Connect_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, ACE_HANDLE event, @@ -828,7 +828,7 @@ public: * this call to that method. We have put this here to avoid the * compiler warnings. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor = 0); @@ -969,7 +969,7 @@ public: u_long flags (void) const; protected: - ACE_POSIX_Asynch_Transmit_File_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Transmit_File_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -1142,7 +1142,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Write_Stream factory. - ACE_POSIX_Asynch_Write_Dgram_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Write_Dgram_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -1275,7 +1275,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Read_Dgram factory. - ACE_POSIX_Asynch_Read_Dgram_Result (ACE_Handler &handler, + ACE_POSIX_Asynch_Read_Dgram_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, diff --git a/ace/POSIX_Proactor.cpp b/ace/POSIX_Proactor.cpp index 3f999a99c8f..c23d0cccff6 100644 --- a/ace/POSIX_Proactor.cpp +++ b/ace/POSIX_Proactor.cpp @@ -38,7 +38,7 @@ class ACE_Export ACE_POSIX_Wakeup_Completion : public ACE_POSIX_Asynch_Result { public: /// Constructor. - ACE_POSIX_Wakeup_Completion (ACE_Handler &handler, + ACE_POSIX_Wakeup_Completion (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act = 0, ACE_HANDLE event = ACE_INVALID_HANDLE, int priority = 0, @@ -158,18 +158,19 @@ ACE_POSIX_Proactor::create_asynch_read_stream (void) } ACE_Asynch_Read_Stream_Result_Impl * -ACE_POSIX_Proactor::create_asynch_read_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_read_stream_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Read_Stream_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Read_Stream_Result (handler, + ACE_POSIX_Asynch_Read_Stream_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -193,18 +194,19 @@ ACE_POSIX_Proactor::create_asynch_write_stream (void) } ACE_Asynch_Write_Stream_Result_Impl * -ACE_POSIX_Proactor::create_asynch_write_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_write_stream_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Write_Stream_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Write_Stream_Result (handler, + ACE_POSIX_Asynch_Write_Stream_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -228,20 +230,21 @@ ACE_POSIX_Proactor::create_asynch_read_file (void) } ACE_Asynch_Read_File_Result_Impl * -ACE_POSIX_Proactor::create_asynch_read_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_read_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Read_File_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Read_File_Result (handler, + ACE_POSIX_Asynch_Read_File_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -267,20 +270,21 @@ ACE_POSIX_Proactor::create_asynch_write_file (void) } ACE_Asynch_Write_File_Result_Impl * -ACE_POSIX_Proactor::create_asynch_write_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_write_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Write_File_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Write_File_Result (handler, + ACE_POSIX_Asynch_Write_File_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -306,20 +310,21 @@ ACE_POSIX_Proactor::create_asynch_read_dgram (void) } ACE_Asynch_Read_Dgram_Result_Impl * -ACE_POSIX_Proactor::create_asynch_read_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event , - int priority , - int signal_number) +ACE_POSIX_Proactor::create_asynch_read_dgram_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event , + int priority , + int signal_number) { ACE_Asynch_Read_Dgram_Result_Impl *implementation=0; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Read_Dgram_Result(handler, + ACE_POSIX_Asynch_Read_Dgram_Result(handler_proxy, handle, message_block, bytes_to_read, @@ -347,19 +352,20 @@ ACE_POSIX_Proactor::create_asynch_write_dgram (void) } ACE_Asynch_Write_Dgram_Result_Impl * -ACE_POSIX_Proactor::create_asynch_write_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event, - int priority , - int signal_number) +ACE_POSIX_Proactor::create_asynch_write_dgram_result + (ACE_Handler::Proxy_ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event, + int priority , + int signal_number) { ACE_Asynch_Write_Dgram_Result_Impl *implementation=0; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Write_Dgram_Result(handler, + ACE_POSIX_Asynch_Write_Dgram_Result(handler_proxy, handle, message_block, bytes_to_write, @@ -386,19 +392,20 @@ ACE_POSIX_Proactor::create_asynch_accept (void) } ACE_Asynch_Accept_Result_Impl * -ACE_POSIX_Proactor::create_asynch_accept_result (ACE_Handler &handler, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_accept_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Accept_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Accept_Result (handler, + ACE_POSIX_Asynch_Accept_Result (handler_proxy, listen_handle, accept_handle, message_block, @@ -424,16 +431,17 @@ ACE_POSIX_Proactor::create_asynch_connect (void) } ACE_Asynch_Connect_Result_Impl * -ACE_POSIX_Proactor::create_asynch_connect_result (ACE_Handler &handler, - ACE_HANDLE connect_handle, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_connect_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Connect_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Connect_Result (handler, + ACE_POSIX_Asynch_Connect_Result (handler_proxy, connect_handle, act, event, @@ -455,23 +463,24 @@ ACE_POSIX_Proactor::create_asynch_transmit_file (void) } ACE_Asynch_Transmit_File_Result_Impl * -ACE_POSIX_Proactor::create_asynch_transmit_file_result (ACE_Handler &handler, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_transmit_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Transmit_File_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Transmit_File_Result (handler, + ACE_POSIX_Asynch_Transmit_File_Result (handler_proxy, socket, file, header_and_trailer, @@ -489,16 +498,17 @@ ACE_POSIX_Proactor::create_asynch_transmit_file_result (ACE_Handler &handler, } ACE_Asynch_Result_Impl * -ACE_POSIX_Proactor::create_asynch_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Proactor::create_asynch_timer + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Timer (handler, + ACE_POSIX_Asynch_Timer (handler_proxy, act, tv, event, @@ -569,9 +579,10 @@ ACE_POSIX_Proactor::post_wakeup_completions (int how_many) for (int ci = 0; ci < how_many; ci++) { - ACE_NEW_RETURN (wakeup_completion, - ACE_POSIX_Wakeup_Completion (this->wakeup_handler_), - -1); + ACE_NEW_RETURN + (wakeup_completion, + ACE_POSIX_Wakeup_Completion (this->wakeup_handler_.proxy ()), + -1); if (this->post_completion (wakeup_completion) == -1) return -1; } @@ -1715,12 +1726,13 @@ ACE_POSIX_SIG_Proactor::notify_completion (int sig_num) } ACE_Asynch_Result_Impl * -ACE_POSIX_SIG_Proactor::create_asynch_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_SIG_Proactor::create_asynch_timer + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) { int is_member = 0; @@ -1755,7 +1767,7 @@ ACE_POSIX_SIG_Proactor::create_asynch_timer (ACE_Handler &handler, ACE_Asynch_Result_Impl *implementation; ACE_NEW_RETURN (implementation, - ACE_POSIX_Asynch_Timer (handler, + ACE_POSIX_Asynch_Timer (handler_proxy, act, tv, event, @@ -1962,14 +1974,16 @@ ACE_POSIX_SIG_Proactor::handle_events_i (const ACE_Time_Value *timeout) // ********************************************************************* -ACE_POSIX_Asynch_Timer::ACE_POSIX_Asynch_Timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Asynch_Timer::ACE_POSIX_Asynch_Timer + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_POSIX_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), time_ (tv) { } @@ -1980,19 +1994,28 @@ ACE_POSIX_Asynch_Timer::complete (size_t /* bytes_transferred */, const void * /* completion_key */, u_long /* error */) { - this->handler_.handle_time_out (this->time_, this->act ()); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_time_out (this->time_, this->act ()); } // ********************************************************************* -ACE_POSIX_Wakeup_Completion::ACE_POSIX_Wakeup_Completion (ACE_Handler &handler, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_POSIX_Wakeup_Completion::ACE_POSIX_Wakeup_Completion + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), - ACE_POSIX_Asynch_Result (handler, act, event, 0, 0, priority, signal_number) + ACE_POSIX_Asynch_Result (handler_proxy, + act, + event, + 0, + 0, + priority, + signal_number) { } @@ -2007,7 +2030,9 @@ ACE_POSIX_Wakeup_Completion::complete (size_t /* bytes_transferred */, u_long /* error */) { - this->handler_.handle_wakeup (); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_wakeup (); } diff --git a/ace/POSIX_Proactor.h b/ace/POSIX_Proactor.h index e8e0897e3d4..37cdbba197b 100644 --- a/ace/POSIX_Proactor.h +++ b/ace/POSIX_Proactor.h @@ -160,7 +160,7 @@ public: virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void); virtual ACE_Asynch_Read_Stream_Result_Impl * - create_asynch_read_stream_result (ACE_Handler &handler, + create_asynch_read_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -171,7 +171,7 @@ public: virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void); virtual ACE_Asynch_Write_Stream_Result_Impl * - create_asynch_write_stream_result (ACE_Handler &handler, + create_asynch_write_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -182,7 +182,7 @@ public: virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void); virtual ACE_Asynch_Read_File_Result_Impl * - create_asynch_read_file_result (ACE_Handler &handler, + create_asynch_read_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -195,7 +195,7 @@ public: virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void); virtual ACE_Asynch_Write_File_Result_Impl * - create_asynch_write_file_result (ACE_Handler &handler, + create_asynch_write_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -208,7 +208,7 @@ public: virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void); virtual ACE_Asynch_Read_Dgram_Result_Impl * - create_asynch_read_dgram_result (ACE_Handler &handler, + create_asynch_read_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, @@ -221,7 +221,7 @@ public: virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void); virtual ACE_Asynch_Write_Dgram_Result_Impl * - create_asynch_write_dgram_result (ACE_Handler &handler, + create_asynch_write_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -233,7 +233,7 @@ public: virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void); virtual ACE_Asynch_Accept_Result_Impl * - create_asynch_accept_result (ACE_Handler &handler, + create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -245,7 +245,7 @@ public: virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void); virtual ACE_Asynch_Connect_Result_Impl * - create_asynch_connect_result (ACE_Handler & handler, + create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void *act, ACE_HANDLE event = ACE_INVALID_HANDLE, @@ -254,7 +254,7 @@ public: virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void); virtual ACE_Asynch_Transmit_File_Result_Impl * - create_asynch_transmit_file_result (ACE_Handler &handler, + create_asynch_transmit_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -271,7 +271,7 @@ public: /// Create a timer result object which can be used with the Timer /// mechanism of the Proactor. virtual ACE_Asynch_Result_Impl * - create_asynch_timer (ACE_Handler &handler, + create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event = ACE_INVALID_HANDLE, @@ -563,12 +563,13 @@ public: * which the Proactor will be waiting) of the Proactor. If there are * more than one signal, the higher numbered signal will be chosen. */ - virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); + virtual ACE_Asynch_Result_Impl *create_asynch_timer + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); protected: /// To setup the handler for a real-time signbal. @@ -628,7 +629,7 @@ class ACE_Export ACE_POSIX_Asynch_Timer : public ACE_POSIX_Asynch_Result protected: /// Constructor. - ACE_POSIX_Asynch_Timer (ACE_Handler &handler, + ACE_POSIX_Asynch_Timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event = ACE_INVALID_HANDLE, diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp index 6da0e3229d9..c8012d7727b 100644 --- a/ace/Proactor.cpp +++ b/ace/Proactor.cpp @@ -218,7 +218,7 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &, // Create the Asynch_Timer. ACE_Asynch_Result_Impl *asynch_timer = - this->proactor_->create_asynch_timer (*handler, + this->proactor_->create_asynch_timer (handler->proxy (), act, time, ACE_INVALID_HANDLE, @@ -856,228 +856,242 @@ ACE_Proactor::create_asynch_transmit_file (void) } ACE_Asynch_Read_Stream_Result_Impl * -ACE_Proactor::create_asynch_read_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - return this->implementation ()->create_asynch_read_stream_result (handler, - handle, - message_block, - bytes_to_read, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_read_stream_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_read_stream_result + (handler_proxy, + handle, + message_block, + bytes_to_read, + act, + event, + priority, + signal_number); } ACE_Asynch_Write_Stream_Result_Impl * -ACE_Proactor::create_asynch_write_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - -{ - return this->implementation ()->create_asynch_write_stream_result (handler, - handle, - message_block, - bytes_to_write, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_write_stream_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_write_stream_result + (handler_proxy, + handle, + message_block, + bytes_to_write, + act, + event, + priority, + signal_number); } ACE_Asynch_Read_File_Result_Impl * -ACE_Proactor::create_asynch_read_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) - -{ - return this->implementation ()->create_asynch_read_file_result (handler, - handle, - message_block, - bytes_to_read, - act, - offset, - offset_high, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_read_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_read_file_result + (handler_proxy, + handle, + message_block, + bytes_to_read, + act, + offset, + offset_high, + event, + priority, + signal_number); } ACE_Asynch_Write_File_Result_Impl * -ACE_Proactor::create_asynch_write_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) - -{ - return this->implementation ()->create_asynch_write_file_result (handler, - handle, - message_block, - bytes_to_write, - act, - offset, - offset_high, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_write_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_write_file_result + (handler_proxy, + handle, + message_block, + bytes_to_write, + act, + offset, + offset_high, + event, + priority, + signal_number); } ACE_Asynch_Read_Dgram_Result_Impl * -ACE_Proactor::create_asynch_read_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - return this->implementation()->create_asynch_read_dgram_result (handler, - handle, - message_block, - bytes_to_read, - flags, - protocol_family, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_read_dgram_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation()->create_asynch_read_dgram_result + (handler_proxy, + handle, + message_block, + bytes_to_read, + flags, + protocol_family, + act, + event, + priority, + signal_number); } ACE_Asynch_Write_Dgram_Result_Impl * -ACE_Proactor::create_asynch_write_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) -{ - return this->implementation()->create_asynch_write_dgram_result (handler, - handle, - message_block, - bytes_to_write, - flags, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_write_dgram_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation()->create_asynch_write_dgram_result + (handler_proxy, + handle, + message_block, + bytes_to_write, + flags, + act, + event, + priority, + signal_number); } ACE_Asynch_Accept_Result_Impl * -ACE_Proactor::create_asynch_accept_result (ACE_Handler &handler, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - u_long bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - -{ - return this->implementation ()->create_asynch_accept_result (handler, - listen_handle, - accept_handle, - message_block, - bytes_to_read, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_accept_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + u_long bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_accept_result + (handler_proxy, + listen_handle, + accept_handle, + message_block, + bytes_to_read, + act, + event, + priority, + signal_number); } ACE_Asynch_Connect_Result_Impl * -ACE_Proactor::create_asynch_connect_result (ACE_Handler &handler, - ACE_HANDLE connect_handle, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) - -{ - return this->implementation ()->create_asynch_connect_result (handler, - connect_handle, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_connect_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_connect_result + (handler_proxy, + connect_handle, + act, + event, + priority, + signal_number); } ACE_Asynch_Transmit_File_Result_Impl * -ACE_Proactor::create_asynch_transmit_file_result (ACE_Handler &handler, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - u_long bytes_to_write, - u_long offset, - u_long offset_high, - u_long bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) - -{ - return this->implementation ()->create_asynch_transmit_file_result (handler, - socket, - file, - header_and_trailer, - bytes_to_write, - offset, - offset_high, - bytes_per_send, - flags, - act, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_transmit_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + u_long bytes_to_write, + u_long offset, + u_long offset_high, + u_long bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_transmit_file_result + (handler_proxy, + socket, + file, + header_and_trailer, + bytes_to_write, + offset, + offset_high, + bytes_per_send, + flags, + act, + event, + priority, + signal_number); } ACE_Asynch_Result_Impl * -ACE_Proactor::create_asynch_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) -{ - return this->implementation ()->create_asynch_timer (handler, - act, - tv, - event, - priority, - signal_number); +ACE_Proactor::create_asynch_timer + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) +{ + return this->implementation ()->create_asynch_timer + (handler_proxy, + act, + tv, + event, + priority, + signal_number); } int diff --git a/ace/Proactor.h b/ace/Proactor.h index b78142619b7..8ed6aa83a02 100644 --- a/ace/Proactor.h +++ b/ace/Proactor.h @@ -443,7 +443,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Read_Stream::Result class. virtual ACE_Asynch_Read_Stream_Result_Impl * - create_asynch_read_stream_result (ACE_Handler &handler, + create_asynch_read_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_read, @@ -455,7 +455,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Write_Stream::Result. virtual ACE_Asynch_Write_Stream_Result_Impl * - create_asynch_write_stream_result (ACE_Handler &handler, + create_asynch_write_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_write, @@ -467,7 +467,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Read_File::Result. virtual ACE_Asynch_Read_File_Result_Impl * - create_asynch_read_file_result (ACE_Handler &handler, + create_asynch_read_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_read, @@ -481,7 +481,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Write_File::Result. virtual ACE_Asynch_Write_File_Result_Impl * - create_asynch_write_file_result (ACE_Handler &handler, + create_asynch_write_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_write, @@ -495,7 +495,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Read_Dgram::Result. virtual ACE_Asynch_Read_Dgram_Result_Impl * - create_asynch_read_dgram_result (ACE_Handler &handler, + create_asynch_read_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, @@ -509,7 +509,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Write_Dgram::Result. virtual ACE_Asynch_Write_Dgram_Result_Impl * - create_asynch_write_dgram_result (ACE_Handler &handler, + create_asynch_write_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -521,7 +521,7 @@ public: /// Create the correct implementation class for ACE_Asynch_Accept::Result. virtual ACE_Asynch_Accept_Result_Impl * - create_asynch_accept_result (ACE_Handler &handler, + create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -533,7 +533,7 @@ public: /// Create the correct implementation class for ACE_Asynch_Connect::Result virtual ACE_Asynch_Connect_Result_Impl * - create_asynch_connect_result (ACE_Handler &handler, + create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, ACE_HANDLE event = ACE_INVALID_HANDLE, @@ -543,7 +543,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Transmit_File::Result. virtual ACE_Asynch_Transmit_File_Result_Impl * - create_asynch_transmit_file_result (ACE_Handler &handler, + create_asynch_transmit_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -564,12 +564,13 @@ public: * Timer object with a meaningful signal number, choosing the * largest signal number from the signal mask of the Proactor. */ - virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); + virtual ACE_Asynch_Result_Impl * + create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); protected: diff --git a/ace/Proactor_Impl.h b/ace/Proactor_Impl.h index ae41266d180..96a9e1bdab3 100644 --- a/ace/Proactor_Impl.h +++ b/ace/Proactor_Impl.h @@ -125,117 +125,127 @@ public: // methods unless they want to "fake" results. /// Create the correct implementation class for ACE_Asynch_Read_Stream::Result class. - virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Read_Stream_Result_Impl * + create_asynch_read_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Write_Stream::Result. - virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Write_Stream_Result_Impl * + create_asynch_write_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Read_File::Result. - virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Read_File_Result_Impl * + create_asynch_read_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Write_File::Result. - virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Write_File_Result_Impl * + create_asynch_write_file_result (ACE_Handler::Proxy_Ptr &handler, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. - virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Read_Dgram_Result_Impl * + create_asynch_read_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. - virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Write_Dgram_Result_Impl * + create_asynch_write_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Accept::Result. - virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (ACE_Handler &handler, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Accept_Result_Impl * + create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Connect::Result. - virtual ACE_Asynch_Connect_Result_Impl *create_asynch_connect_result (ACE_Handler &handler, - ACE_HANDLE connect_handle, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Connect_Result_Impl * + create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /// Create the correct implementation class for ACE_Asynch_Transmit_File::Result. - virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (ACE_Handler &handler, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN) = 0; + virtual ACE_Asynch_Transmit_File_Result_Impl * + create_asynch_transmit_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN) = 0; /** * Create the correct implementation object for the Timer * result. POSIX_SIG_Proactor will create a Timer object with a * meaningful signal number, if you leave the signal number as 0. */ - virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = 0) = 0; + virtual ACE_Asynch_Result_Impl * + create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = 0) = 0; /** * Post <how_many> completions to the completion port so that all diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp index 8e8c511f195..b88ae61b5f4 100644 --- a/ace/WIN32_Asynch_IO.cpp +++ b/ace/WIN32_Asynch_IO.cpp @@ -108,16 +108,17 @@ ACE_WIN32_Asynch_Result::~ACE_WIN32_Asynch_Result (void) { } -ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result (ACE_Handler &handler, - const void* act, - ACE_HANDLE event, - u_long offset, - u_long offset_high, - int priority, - int signal_number) +ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void* act, + ACE_HANDLE event, + u_long offset, + u_long offset_high, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), OVERLAPPED (), - handler_ (handler), + handler_proxy_ (handler_proxy), act_ (act), bytes_transferred_ (0), success_ (0), @@ -136,18 +137,22 @@ ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result (ACE_Handler &handler, } int -ACE_WIN32_Asynch_Operation::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Operation::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { this->proactor_ = proactor; - this->handler_ = &handler; + this->handler_proxy_ = handler_proxy; this->handle_ = handle; // Grab the handle from the <handler> if <handle> is invalid if (this->handle_ == ACE_INVALID_HANDLE) - this->handle_ = this->handler_->handle (); + { + ACE_Handler *handler = handler_proxy.get ()->handler (); + if (handler != 0) + this->handle_ = handler->handle (); + } if (this->handle_ == ACE_INVALID_HANDLE) return -1; @@ -194,7 +199,6 @@ ACE_WIN32_Asynch_Operation::ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win3 : ACE_Asynch_Operation_Impl (), win32_proactor_ (win32_proactor), proactor_ (0), - handler_ (0), handle_ (ACE_INVALID_HANDLE) { } @@ -224,7 +228,7 @@ ACE_WIN32_Asynch_Read_Stream_Result::handle (void) const } ACE_WIN32_Asynch_Read_Stream_Result::ACE_WIN32_Asynch_Read_Stream_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -235,7 +239,7 @@ ACE_WIN32_Asynch_Read_Stream_Result::ACE_WIN32_Asynch_Read_Stream_Result ( int scatter_enabled) : ACE_Asynch_Result_Impl (), ACE_Asynch_Read_Stream_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, @@ -285,7 +289,9 @@ ACE_WIN32_Asynch_Read_Stream_Result::complete (size_t bytes_transferred, ACE_Asynch_Read_Stream::Result result (this); // Call the application handler. - this->handler_.handle_read_stream (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_stream (result); } ACE_WIN32_Asynch_Read_Stream_Result::~ACE_WIN32_Asynch_Read_Stream_Result (void) @@ -394,7 +400,7 @@ ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block, // Create the Asynch_Result. ACE_WIN32_Asynch_Read_Stream_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_Stream_Result (*this->handler_, + ACE_WIN32_Asynch_Read_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -486,7 +492,7 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, // Create the Asynch_Result. ACE_WIN32_Asynch_Read_Stream_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_Stream_Result (*this->handler_, + ACE_WIN32_Asynch_Read_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -612,12 +618,12 @@ ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result * // call to the ACE_WIN32_Asynch_Operation base class. int -ACE_WIN32_Asynch_Read_Stream::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Read_Stream::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -654,7 +660,7 @@ ACE_WIN32_Asynch_Write_Stream_Result::handle (void) const } ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -665,7 +671,8 @@ ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result ( int gather_enabled) : ACE_Asynch_Result_Impl (), ACE_Asynch_Write_Stream_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_WIN32_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_write_ (bytes_to_write), message_block_ (message_block), handle_ (handle), @@ -709,7 +716,9 @@ ACE_WIN32_Asynch_Write_Stream_Result::complete (size_t bytes_transferred, ACE_Asynch_Write_Stream::Result result (this); // Call the application handler. - this->handler_.handle_write_stream (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_stream (result); } ACE_WIN32_Asynch_Write_Stream_Result::~ACE_WIN32_Asynch_Write_Stream_Result (void) @@ -819,7 +828,7 @@ ACE_WIN32_Asynch_Write_Stream::write (ACE_Message_Block &message_block, ACE_WIN32_Asynch_Write_Stream_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_Stream_Result (*this->handler_, + ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -908,7 +917,7 @@ ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, ACE_WIN32_Asynch_Write_Stream_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_Stream_Result (*this->handler_, + ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -1027,12 +1036,12 @@ ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Resul // call to the ACE_WIN32_Asynch_Operation base class. int -ACE_WIN32_Asynch_Write_Stream::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Write_Stream::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -1051,7 +1060,7 @@ ACE_WIN32_Asynch_Write_Stream::proactor (void) const } ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -1065,7 +1074,7 @@ ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result ( : ACE_Asynch_Result_Impl (), ACE_Asynch_Read_Stream_Result_Impl (), ACE_Asynch_Read_File_Result_Impl (), - ACE_WIN32_Asynch_Read_Stream_Result (handler, + ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -1121,7 +1130,9 @@ ACE_WIN32_Asynch_Read_File_Result::complete (size_t bytes_transferred, ACE_Asynch_Read_File::Result result (this); // Call the application handler. - this->handler_.handle_read_file (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_file (result); } ACE_WIN32_Asynch_Read_File_Result::~ACE_WIN32_Asynch_Read_File_Result (void) @@ -1253,7 +1264,7 @@ ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block, ACE_WIN32_Asynch_Read_File_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_File_Result (*this->handler_, + ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -1331,7 +1342,7 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block, ACE_WIN32_Asynch_Read_File_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_File_Result (*this->handler_, + ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -1427,12 +1438,12 @@ ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block, // call to the ACE_WIN32_Asynch_Operation base class. int -ACE_WIN32_Asynch_Read_File::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Read_File::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -1451,7 +1462,7 @@ ACE_WIN32_Asynch_Read_File::proactor (void) const } ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -1465,7 +1476,7 @@ ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result ( : ACE_Asynch_Result_Impl (), ACE_Asynch_Write_Stream_Result_Impl (), ACE_Asynch_Write_File_Result_Impl (), - ACE_WIN32_Asynch_Write_Stream_Result (handler, + ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -1522,7 +1533,9 @@ ACE_WIN32_Asynch_Write_File_Result::complete (size_t bytes_transferred, ACE_Asynch_Write_File::Result result (this); // Call the application handler. - this->handler_.handle_write_file (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_file (result); } ACE_WIN32_Asynch_Write_File_Result::~ACE_WIN32_Asynch_Write_File_Result (void) @@ -1651,7 +1664,7 @@ ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block, ACE_WIN32_Asynch_Write_File_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_File_Result (*this->handler_, + ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -1734,7 +1747,7 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block, ACE_WIN32_Asynch_Write_File_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_File_Result (*this->handler_, + ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -1832,12 +1845,12 @@ ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block, // call to the ACE_WIN32_Asynch_Operation base class. int -ACE_WIN32_Asynch_Write_File::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Write_File::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -1880,7 +1893,7 @@ ACE_WIN32_Asynch_Accept_Result::accept_handle (void) const } ACE_WIN32_Asynch_Accept_Result::ACE_WIN32_Asynch_Accept_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -1891,7 +1904,7 @@ ACE_WIN32_Asynch_Accept_Result::ACE_WIN32_Asynch_Accept_Result ( int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Accept_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, @@ -1924,7 +1937,9 @@ ACE_WIN32_Asynch_Accept_Result::complete (size_t bytes_transferred, ACE_Asynch_Accept::Result result (this); // Call the application handler. - this->handler_.handle_accept (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_accept (result); } ACE_WIN32_Asynch_Accept_Result::~ACE_WIN32_Asynch_Accept_Result (void) @@ -2061,7 +2076,7 @@ ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block, // Common code for both WIN and POSIX. ACE_WIN32_Asynch_Accept_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Accept_Result (*this->handler_, + ACE_WIN32_Asynch_Accept_Result (this->handler_proxy_, this->handle_, accept_handle, message_block, @@ -2135,12 +2150,12 @@ ACE_WIN32_Asynch_Accept::~ACE_WIN32_Asynch_Accept (void) // call to the ACE_WIN32_Asynch_Operation base class. int -ACE_WIN32_Asynch_Accept::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Accept::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -2173,7 +2188,7 @@ void ACE_WIN32_Asynch_Connect_Result::connect_handle ( ACE_HANDLE handle ) ACE_WIN32_Asynch_Connect_Result::ACE_WIN32_Asynch_Connect_Result - (ACE_Handler &handler, + (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, ACE_HANDLE event, @@ -2181,8 +2196,9 @@ ACE_WIN32_Asynch_Connect_Result::ACE_WIN32_Asynch_Connect_Result int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Connect_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), - connect_handle_ ( connect_handle ) + ACE_WIN32_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), + connect_handle_ (connect_handle) { ; } @@ -2203,7 +2219,9 @@ ACE_WIN32_Asynch_Connect_Result::complete (size_t bytes_transferred, ACE_Asynch_Connect::Result result (this); // Call the application handler. - this->handler_.handle_connect (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_connect (result); } ACE_WIN32_Asynch_Connect_Result::~ACE_WIN32_Asynch_Connect_Result (void) @@ -2317,7 +2335,7 @@ ACE_WIN32_Asynch_Connect::set_handle (ACE_HANDLE) } int -ACE_WIN32_Asynch_Connect::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Connect::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE, const void *completion_key, ACE_Proactor *proactor) @@ -2335,7 +2353,7 @@ ACE_WIN32_Asynch_Connect::open (ACE_Handler &handler, -1); //int result = - ACE_WIN32_Asynch_Operation::open (handler, + ACE_WIN32_Asynch_Operation::open (handler_proxy, ACE_INVALID_HANDLE, completion_key, proactor); @@ -2373,7 +2391,7 @@ ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle, // Create future Asynch_Connect_Result ACE_WIN32_Asynch_Connect_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Connect_Result (*this->handler_, + ACE_WIN32_Asynch_Connect_Result (this->handler_proxy_, connect_handle, act, this->win32_proactor_->get_handle (), @@ -2837,7 +2855,7 @@ ACE_WIN32_Asynch_Transmit_File_Result::flags (void) const } ACE_WIN32_Asynch_Transmit_File_Result::ACE_WIN32_Asynch_Transmit_File_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -2852,7 +2870,7 @@ ACE_WIN32_Asynch_Transmit_File_Result::ACE_WIN32_Asynch_Transmit_File_Result ( int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Transmit_File_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, + ACE_WIN32_Asynch_Result (handler_proxy, act, event, offset, @@ -2900,7 +2918,9 @@ ACE_WIN32_Asynch_Transmit_File_Result::complete (size_t bytes_transferred, ACE_Asynch_Transmit_File::Result result (this); // Call the application handler. - this->handler_.handle_transmit_file (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_transmit_file (result); } ACE_WIN32_Asynch_Transmit_File_Result::~ACE_WIN32_Asynch_Transmit_File_Result (void) @@ -3008,7 +3028,7 @@ ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, ACE_WIN32_Asynch_Transmit_File_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Transmit_File_Result (*this->handler_, + ACE_WIN32_Asynch_Transmit_File_Result (this->handler_proxy_, this->handle_, file, header_and_trailer, @@ -3087,12 +3107,12 @@ ACE_WIN32_Asynch_Transmit_File::~ACE_WIN32_Asynch_Transmit_File (void) // call to the ACE_WIN32_Asynch_Operation base class. int -ACE_WIN32_Asynch_Transmit_File::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Transmit_File::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -3225,7 +3245,7 @@ ACE_WIN32_Asynch_Read_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor } ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, @@ -3237,7 +3257,7 @@ ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result ( int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Read_Dgram_Result_Impl(), - ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority, signal_number), + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_read_ (bytes_to_read), message_block_ (message_block), remote_address_ (0), @@ -3287,7 +3307,9 @@ ACE_WIN32_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred, ACE_Asynch_Read_Dgram::Result result (this); // Call the application handler. - this->handler_.handle_read_dgram (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_dgram (result); } ACE_WIN32_Asynch_Read_Dgram_Result::~ACE_WIN32_Asynch_Read_Dgram_Result (void) @@ -3367,7 +3389,7 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, // Create the Asynch_Result. ACE_WIN32_Asynch_Read_Dgram_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Read_Dgram_Result (*this->handler_, + ACE_WIN32_Asynch_Read_Dgram_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_read, @@ -3433,12 +3455,12 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, } int -ACE_WIN32_Asynch_Read_Dgram::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Read_Dgram::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); @@ -3556,7 +3578,7 @@ ACE_WIN32_Asynch_Write_Dgram_Result::post_completion (ACE_Proactor_Impl *proacto } ACE_WIN32_Asynch_Write_Dgram_Result::ACE_WIN32_Asynch_Write_Dgram_Result ( - ACE_Handler &handler, + ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -3567,7 +3589,7 @@ ACE_WIN32_Asynch_Write_Dgram_Result::ACE_WIN32_Asynch_Write_Dgram_Result ( int signal_number) : ACE_Asynch_Result_Impl (), ACE_Asynch_Write_Dgram_Result_Impl(), - ACE_WIN32_Asynch_Result (handler, + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, @@ -3612,7 +3634,9 @@ ACE_WIN32_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred, ACE_Asynch_Write_Dgram::Result result (this); // Call the application handler. - this->handler_.handle_write_dgram (result); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_dgram (result); } ACE_WIN32_Asynch_Write_Dgram_Result::~ACE_WIN32_Asynch_Write_Dgram_Result (void) @@ -3692,7 +3716,7 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, // Create the Asynch_Result. ACE_WIN32_Asynch_Write_Dgram_Result *result = 0; ACE_NEW_RETURN (result, - ACE_WIN32_Asynch_Write_Dgram_Result (*this->handler_, + ACE_WIN32_Asynch_Write_Dgram_Result (this->handler_proxy_, this->handle_, message_block, bytes_to_write, @@ -3760,12 +3784,12 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, } int -ACE_WIN32_Asynch_Write_Dgram::open (ACE_Handler &handler, +ACE_WIN32_Asynch_Write_Dgram::open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { - return ACE_WIN32_Asynch_Operation::open (handler, + return ACE_WIN32_Asynch_Operation::open (handler_proxy, handle, completion_key, proactor); diff --git a/ace/WIN32_Asynch_IO.h b/ace/WIN32_Asynch_IO.h index b9d875164b1..c9d26ff00a6 100644 --- a/ace/WIN32_Asynch_IO.h +++ b/ace/WIN32_Asynch_IO.h @@ -116,7 +116,7 @@ public: protected: /// Constructor. - ACE_WIN32_Asynch_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Result (ACE_Handler::Proxy_Ptr &handler_proxy, const void* act, ACE_HANDLE event, u_long offset, @@ -124,8 +124,8 @@ protected: int priority, int signal_number = 0); - /// Handler that will be called back. - ACE_Handler &handler_; + /// Proxy for the ACE_Handler that will be called back. + ACE_Handler::Proxy_Ptr &handler_proxy_; /// ACT for this operation. const void *act_; @@ -159,7 +159,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -190,7 +190,7 @@ protected: ACE_Proactor *proactor_; /// Handler that will receive the callback. - ACE_Handler *handler_; + ACE_Handler::Proxy_Ptr handler_proxy_; /// I/O handle used for reading. ACE_HANDLE handle_; @@ -269,7 +269,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Read_Stream factory. - ACE_WIN32_Asynch_Read_Stream_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Read_Stream_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -352,7 +352,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -446,7 +446,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Write_Stream factory. - ACE_WIN32_Asynch_Write_Stream_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Write_Stream_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -531,7 +531,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -628,7 +628,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Read_File factory. - ACE_WIN32_Asynch_Read_File_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Read_File_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -715,7 +715,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -839,7 +839,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Write_File factory. - ACE_WIN32_Asynch_Write_File_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Write_File_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -921,7 +921,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -1036,7 +1036,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Accept factory. - ACE_WIN32_Asynch_Accept_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Accept_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -1118,7 +1118,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -1202,7 +1202,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Connect factory. - ACE_WIN32_Asynch_Connect_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Connect_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, ACE_HANDLE event, @@ -1246,7 +1246,7 @@ public: * this call to that method. We have put this here to avoid the * compiler warnings. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor = 0); @@ -1440,7 +1440,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Transmit_File factory. - ACE_WIN32_Asynch_Transmit_File_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Transmit_File_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -1545,7 +1545,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -1639,7 +1639,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Read_Dgram factory. - ACE_WIN32_Asynch_Read_Dgram_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Read_Dgram_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, @@ -1735,7 +1735,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); @@ -1828,7 +1828,7 @@ public: protected: /// Constructor is protected since creation is limited to /// ACE_Asynch_Write_Stream factory. - ACE_WIN32_Asynch_Write_Dgram_Result (ACE_Handler &handler, + ACE_WIN32_Asynch_Write_Dgram_Result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -1920,7 +1920,7 @@ public: * <ACE_Handler::handle> will be called on the <handler> to get the * correct handle. */ - int open (ACE_Handler &handler, + int open (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor); diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp index 39a70da300f..62458aed76f 100644 --- a/ace/WIN32_Proactor.cpp +++ b/ace/WIN32_Proactor.cpp @@ -24,7 +24,7 @@ class ACE_Export ACE_WIN32_Wakeup_Completion : public ACE_WIN32_Asynch_Result public: /// Constructor. - ACE_WIN32_Wakeup_Completion (ACE_Handler &handler, + ACE_WIN32_Wakeup_Completion (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act = 0, ACE_HANDLE event = ACE_INVALID_HANDLE, int priority = 0, @@ -241,18 +241,19 @@ ACE_WIN32_Proactor::create_asynch_transmit_file (void) } ACE_Asynch_Read_Stream_Result_Impl * -ACE_WIN32_Proactor::create_asynch_read_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Proactor::create_asynch_read_stream_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Read_Stream_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_Stream_Result (handler, + ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -265,18 +266,19 @@ ACE_WIN32_Proactor::create_asynch_read_stream_result (ACE_Handler &handler, } ACE_Asynch_Write_Stream_Result_Impl * -ACE_WIN32_Proactor::create_asynch_write_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Proactor::create_asynch_write_stream_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Write_Stream_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_Stream_Result (handler, + ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -289,20 +291,21 @@ ACE_WIN32_Proactor::create_asynch_write_stream_result (ACE_Handler &handler, } ACE_Asynch_Read_File_Result_Impl * -ACE_WIN32_Proactor::create_asynch_read_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Proactor::create_asynch_read_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Read_File_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_File_Result (handler, + ACE_WIN32_Asynch_Read_File_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -317,20 +320,21 @@ ACE_WIN32_Proactor::create_asynch_read_file_result (ACE_Handler &handler, } ACE_Asynch_Write_File_Result_Impl * -ACE_WIN32_Proactor::create_asynch_write_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - size_t bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Proactor::create_asynch_write_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Write_File_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_File_Result (handler, + ACE_WIN32_Asynch_Write_File_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -345,20 +349,21 @@ ACE_WIN32_Proactor::create_asynch_write_file_result (ACE_Handler &handler, } ACE_Asynch_Read_Dgram_Result_Impl * -ACE_WIN32_Proactor::create_asynch_read_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event , - int priority , - int signal_number) +ACE_WIN32_Proactor::create_asynch_read_dgram_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Read_Dgram_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Read_Dgram_Result (handler, + ACE_WIN32_Asynch_Read_Dgram_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -373,19 +378,20 @@ ACE_WIN32_Proactor::create_asynch_read_dgram_result (ACE_Handler &handler, } ACE_Asynch_Write_Dgram_Result_Impl * -ACE_WIN32_Proactor::create_asynch_write_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - const void* act, - ACE_HANDLE event , - int priority , - int signal_number) +ACE_WIN32_Proactor::create_asynch_write_dgram_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Write_Dgram_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Write_Dgram_Result(handler, + ACE_WIN32_Asynch_Write_Dgram_Result(handler_proxy, handle, message_block, bytes_to_read, @@ -399,19 +405,20 @@ ACE_WIN32_Proactor::create_asynch_write_dgram_result (ACE_Handler &handler, } ACE_Asynch_Accept_Result_Impl * -ACE_WIN32_Proactor::create_asynch_accept_result (ACE_Handler &handler, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - size_t bytes_to_read, - const void* act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Proactor::create_asynch_accept_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Accept_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Accept_Result (handler, + ACE_WIN32_Asynch_Accept_Result (handler_proxy, listen_handle, accept_handle, message_block, @@ -425,16 +432,17 @@ ACE_WIN32_Proactor::create_asynch_accept_result (ACE_Handler &handler, } ACE_Asynch_Connect_Result_Impl * -ACE_WIN32_Proactor::create_asynch_connect_result (ACE_Handler & handler, - ACE_HANDLE connect_handle, - const void *act, - ACE_HANDLE event, - int priority , - int signal_number) +ACE_WIN32_Proactor::create_asynch_connect_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Connect_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Connect_Result (handler, + ACE_WIN32_Asynch_Connect_Result (handler_proxy, connect_handle, act, event, @@ -445,23 +453,24 @@ ACE_WIN32_Proactor::create_asynch_connect_result (ACE_Handler & handler, } ACE_Asynch_Transmit_File_Result_Impl * -ACE_WIN32_Proactor::create_asynch_transmit_file_result (ACE_Handler &handler, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - size_t bytes_to_write, - u_long offset, - u_long offset_high, - size_t bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Proactor::create_asynch_transmit_file_result + (ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) { ACE_Asynch_Transmit_File_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Transmit_File_Result (handler, + ACE_WIN32_Asynch_Transmit_File_Result (handler_proxy, socket, file, header_and_trailer, @@ -479,7 +488,7 @@ ACE_WIN32_Proactor::create_asynch_transmit_file_result (ACE_Handler &handler, } ACE_Asynch_Result_Impl * -ACE_WIN32_Proactor::create_asynch_timer (ACE_Handler &handler, +ACE_WIN32_Proactor::create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event, @@ -488,7 +497,7 @@ ACE_WIN32_Proactor::create_asynch_timer (ACE_Handler &handler, { ACE_Asynch_Result_Impl *implementation = 0; ACE_NEW_RETURN (implementation, - ACE_WIN32_Asynch_Timer (handler, + ACE_WIN32_Asynch_Timer (handler_proxy, act, tv, event, @@ -715,9 +724,10 @@ ACE_WIN32_Proactor::post_wakeup_completions (int how_many) for (ssize_t ci = 0; ci < how_many; ci++) { - ACE_NEW_RETURN (wakeup_completion, - ACE_WIN32_Wakeup_Completion (this->wakeup_handler_), - -1); + ACE_NEW_RETURN + (wakeup_completion, + ACE_WIN32_Wakeup_Completion (this->wakeup_handler_.proxy ()), + -1); if (wakeup_completion->post_completion (this) == -1) return -1; @@ -750,40 +760,40 @@ ACE_WIN32_Proactor::number_of_threads (size_t threads) this->number_of_threads_ = static_cast<DWORD> (threads); } -ACE_WIN32_Asynch_Timer::ACE_WIN32_Asynch_Timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &tv, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Asynch_Timer::ACE_WIN32_Asynch_Timer + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority, + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), time_ (tv) { } void -ACE_WIN32_Asynch_Timer::complete (size_t bytes_transferred, - int success, - const void *completion_key, - u_long error) -{ - ACE_UNUSED_ARG (error); - ACE_UNUSED_ARG (completion_key); - ACE_UNUSED_ARG (success); - ACE_UNUSED_ARG (bytes_transferred); - - this->handler_.handle_time_out (this->time_, this->act ()); -} - -ACE_WIN32_Wakeup_Completion::ACE_WIN32_Wakeup_Completion (ACE_Handler &handler, - const void *act, - ACE_HANDLE event, - int priority, - int signal_number) +ACE_WIN32_Asynch_Timer::complete (size_t, + int, + const void *, + u_long) +{ + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_time_out (this->time_, this->act ()); +} + +ACE_WIN32_Wakeup_Completion::ACE_WIN32_Wakeup_Completion + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) : ACE_Asynch_Result_Impl (), - ACE_WIN32_Asynch_Result (handler, act, event, 0, 0, priority, signal_number) + ACE_WIN32_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number) { } @@ -797,7 +807,9 @@ ACE_WIN32_Wakeup_Completion::complete (size_t /* bytes_transferred */, const void * /* completion_key */, u_long /* error */) { - this->handler_.handle_wakeup (); + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_wakeup (); } #endif /* ACE_WIN32 */ diff --git a/ace/WIN32_Proactor.h b/ace/WIN32_Proactor.h index 0afec3db432..57bfe943e5f 100644 --- a/ace/WIN32_Proactor.h +++ b/ace/WIN32_Proactor.h @@ -121,7 +121,7 @@ public: // Methods used to create Asynch_IO_Result objects. We create the right // objects here in these methods. - virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (ACE_Handler &handler, + virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -130,7 +130,7 @@ public: int priority, int signal_number = 0); - virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (ACE_Handler &handler, + virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -139,7 +139,7 @@ public: int priority, int signal_number = 0); - virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (ACE_Handler &handler, + virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_read, @@ -150,7 +150,7 @@ public: int priority, int signal_number = 0); - virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (ACE_Handler &handler, + virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, size_t bytes_to_write, @@ -162,7 +162,7 @@ public: int signal_number = 0); /// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. - virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (ACE_Handler &handler, + virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, @@ -174,7 +174,7 @@ public: int signal_number = 0); /// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. - virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (ACE_Handler &handler, + virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, @@ -184,7 +184,7 @@ public: int priority, int signal_number = 0); - virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (ACE_Handler &handler, + virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, @@ -194,7 +194,7 @@ public: int priority, int signal_number = 0); - virtual ACE_Asynch_Connect_Result_Impl *create_asynch_connect_result (ACE_Handler & handler, + virtual ACE_Asynch_Connect_Result_Impl *create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void *act, ACE_HANDLE event, @@ -202,7 +202,7 @@ public: int signal_number = 0); - virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (ACE_Handler &handler, + virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, @@ -218,7 +218,7 @@ public: /// Create a timer result object which can be used with the Timer /// mechanism of the Proactor. - virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler &handler, + virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event, @@ -299,7 +299,7 @@ class ACE_Export ACE_WIN32_Asynch_Timer : public ACE_WIN32_Asynch_Result protected: /// Constructor. - ACE_WIN32_Asynch_Timer (ACE_Handler &handler, + ACE_WIN32_Asynch_Timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event = ACE_INVALID_HANDLE, diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 0847e2bf491..9b931b20cc6 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -352,12 +352,6 @@ typedef signed long long ACE_INT64; # endif /* !_MT && !ACE_HAS_WINCE */ #endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ -// We are using STL's min and max (in algobase.h). Therefore the -// macros in window.h are extra -#if !defined (NOMINMAX) -# define NOMINMAX -#endif /* NOMINMAX */ - #if !defined(_DEBUG) // If we are making a release, and the user has not specified // inline directives, we will default to inline |