summaryrefslogtreecommitdiff
path: root/ace/WIN32_Proactor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ace/WIN32_Proactor.cpp')
-rw-r--r--ace/WIN32_Proactor.cpp262
1 files changed, 137 insertions, 125 deletions
diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp
index 6905c0d7912..f4e9a3283ff 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,
@@ -717,9 +726,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;
@@ -752,40 +762,40 @@ ACE_WIN32_Proactor::number_of_threads (size_t threads)
this->number_of_threads_ = ACE_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)
{
}
@@ -799,7 +809,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 */