summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2002-03-28 15:01:21 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2002-03-28 15:01:21 +0000
commitfdde942e7fc7504258fa14140e21422d4561f90e (patch)
tree678de7d60a0c2ab2897e4bbf0b872915a8634b50
parent8cbbb383832e36927b4b1b145233a049d4696fcd (diff)
downloadATCD-fdde942e7fc7504258fa14140e21422d4561f90e.tar.gz
ChangeLogTag:Thu Mar 28 06:15:22 2002 Alex Libman <AlexL@rumblegroup.com>
-rw-r--r--ChangeLog46
-rw-r--r--ChangeLogs/ChangeLog-02a46
-rw-r--r--ChangeLogs/ChangeLog-03a46
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a7
-rw-r--r--TAO/orbsvcs/Naming_Service/README2
-rw-r--r--THANKS2
-rw-r--r--ace/Asynch_Acceptor.cpp6
-rw-r--r--ace/POSIX_Asynch_IO.cpp1198
-rw-r--r--ace/POSIX_Asynch_IO.h310
-rw-r--r--ace/POSIX_Proactor.cpp53
-rw-r--r--ace/POSIX_Proactor.h28
-rw-r--r--ace/POSIX_Proactor.i6
-rw-r--r--ace/SUN_Proactor.cpp8
-rw-r--r--ace/TTY_IO.cpp5
-rw-r--r--ace/TTY_IO.h2
15 files changed, 1059 insertions, 706 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d8f8b10161..facf79afaf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+Thu Mar 28 06:15:22 2002 Alex Libman <AlexL@rumblegroup.com>
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h:
+ ACE_POSIX_AOICB_Asynch_Operation and ACE_POSIX_Asynch_Operation
+ merged in one class ACE_POSIX_Asynch_Operation
+
+ Since POSIX_SIG_Proactor and SUN_Proactor are based on
+ POSIX_AIOCB_Proactor and both of them use
+ ACE_POSIX_AOICB_Asynch_Operation, there is no necessity to
+ support extra class tree.
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h:
+ ACE_POSIX_AOICB_Transmit_Handler and ACE_POSIX_Transmit_Handler
+ merged in ACE_POSIX_Transmit_Handler for same reason as previous
+ change.
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h: ACE_POSIX_Asynch_Accept merged with
+ ACE_POSIX_Asynch_Accept_Hanlder and redesigned and added
+ new class ACE_POSIX_Asynch_Accept_Task.
+
+ POSIX_AIOCB_Proactor has new member
+ ACE_POSIX_Asynch_Accept_Task asynch_accept_task_.
+
+ Task activation should be done from the most derived
+ constructors , when the final table of virtual functions is
+ built (simular case with notify_manager).
+
+ // start asynch accept task
+ this->get_asynch_accept_task.start ();
+
+ All POSIX_Proactors implementations ( AIOCB,SIG,SUN ) should
+ stop ACE_POSIX_Asynch_Accept_Task in their destructors to avoid
+ post_completions from based classes
+
+ // stop asynch accept task
+ this->get_asynch_accept_task.stop ();
+
+Thu Mar 28 06:14:22 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * ace/TTY_IO.cpp (Serial_Params): Zero out the values in the
+ Serial_Params constructor. Thanks to Pavel Repin
+ <pavel@repin.com> for reporting this.
+
Wed Mar 27 20:00:31 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* include/makeinclude/platform_linux.GNU: Fixed a typo where
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 7d8f8b10161..facf79afaf5 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,49 @@
+Thu Mar 28 06:15:22 2002 Alex Libman <AlexL@rumblegroup.com>
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h:
+ ACE_POSIX_AOICB_Asynch_Operation and ACE_POSIX_Asynch_Operation
+ merged in one class ACE_POSIX_Asynch_Operation
+
+ Since POSIX_SIG_Proactor and SUN_Proactor are based on
+ POSIX_AIOCB_Proactor and both of them use
+ ACE_POSIX_AOICB_Asynch_Operation, there is no necessity to
+ support extra class tree.
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h:
+ ACE_POSIX_AOICB_Transmit_Handler and ACE_POSIX_Transmit_Handler
+ merged in ACE_POSIX_Transmit_Handler for same reason as previous
+ change.
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h: ACE_POSIX_Asynch_Accept merged with
+ ACE_POSIX_Asynch_Accept_Hanlder and redesigned and added
+ new class ACE_POSIX_Asynch_Accept_Task.
+
+ POSIX_AIOCB_Proactor has new member
+ ACE_POSIX_Asynch_Accept_Task asynch_accept_task_.
+
+ Task activation should be done from the most derived
+ constructors , when the final table of virtual functions is
+ built (simular case with notify_manager).
+
+ // start asynch accept task
+ this->get_asynch_accept_task.start ();
+
+ All POSIX_Proactors implementations ( AIOCB,SIG,SUN ) should
+ stop ACE_POSIX_Asynch_Accept_Task in their destructors to avoid
+ post_completions from based classes
+
+ // stop asynch accept task
+ this->get_asynch_accept_task.stop ();
+
+Thu Mar 28 06:14:22 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * ace/TTY_IO.cpp (Serial_Params): Zero out the values in the
+ Serial_Params constructor. Thanks to Pavel Repin
+ <pavel@repin.com> for reporting this.
+
Wed Mar 27 20:00:31 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* include/makeinclude/platform_linux.GNU: Fixed a typo where
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 7d8f8b10161..facf79afaf5 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,49 @@
+Thu Mar 28 06:15:22 2002 Alex Libman <AlexL@rumblegroup.com>
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h:
+ ACE_POSIX_AOICB_Asynch_Operation and ACE_POSIX_Asynch_Operation
+ merged in one class ACE_POSIX_Asynch_Operation
+
+ Since POSIX_SIG_Proactor and SUN_Proactor are based on
+ POSIX_AIOCB_Proactor and both of them use
+ ACE_POSIX_AOICB_Asynch_Operation, there is no necessity to
+ support extra class tree.
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h:
+ ACE_POSIX_AOICB_Transmit_Handler and ACE_POSIX_Transmit_Handler
+ merged in ACE_POSIX_Transmit_Handler for same reason as previous
+ change.
+
+ * ace/POSIX_Asynch_IO.cpp,
+ ace/POSIX_Asynch_IO.h: ACE_POSIX_Asynch_Accept merged with
+ ACE_POSIX_Asynch_Accept_Hanlder and redesigned and added
+ new class ACE_POSIX_Asynch_Accept_Task.
+
+ POSIX_AIOCB_Proactor has new member
+ ACE_POSIX_Asynch_Accept_Task asynch_accept_task_.
+
+ Task activation should be done from the most derived
+ constructors , when the final table of virtual functions is
+ built (simular case with notify_manager).
+
+ // start asynch accept task
+ this->get_asynch_accept_task.start ();
+
+ All POSIX_Proactors implementations ( AIOCB,SIG,SUN ) should
+ stop ACE_POSIX_Asynch_Accept_Task in their destructors to avoid
+ post_completions from based classes
+
+ // stop asynch accept task
+ this->get_asynch_accept_task.stop ();
+
+Thu Mar 28 06:14:22 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * ace/TTY_IO.cpp (Serial_Params): Zero out the values in the
+ Serial_Params constructor. Thanks to Pavel Repin
+ <pavel@repin.com> for reporting this.
+
Wed Mar 27 20:00:31 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* include/makeinclude/platform_linux.GNU: Fixed a typo where
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index ac7a33ca517..eefb47f4f74 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,10 @@
+Thu Mar 28 06:46:55 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
+
+ * orbsvcs/Naming_Service/README: Corrected the README to say
+ that SERVICE_DEMAND_START is the proper default option if only
+ -i is specified. Thanks to Whitney Kew
+ <Whitney.Kew@Invensys.com> for reporting this.
+
Wed Mar 27 17:51:19 2002 Jeff Parsons <parsons@cs.wustl.edu>
* TAO_IDL/fe/fe_declarator.cpp (compose):
diff --git a/TAO/orbsvcs/Naming_Service/README b/TAO/orbsvcs/Naming_Service/README
index 4112caf05dc..a4551b3c034 100644
--- a/TAO/orbsvcs/Naming_Service/README
+++ b/TAO/orbsvcs/Naming_Service/README
@@ -282,7 +282,7 @@ standard out.
#define SERVICE_DEMAND_START 0x00000003
#define SERVICE_DISABLED 0x00000004
- If only -i is specified, SERVICE_AUTO_START is default option.
+ If only -i is specified, SERVICE_DEMAND_START is default option.
b. Now you are ready to run the actual service. Run
NT_Naming_Service again, this time with -s option. If the
diff --git a/THANKS b/THANKS
index a295e7202ec..6f093b5a40e 100644
--- a/THANKS
+++ b/THANKS
@@ -1494,6 +1494,8 @@ Ido Yellin <Ido.Yellin@Focusengine.com>
Eric Page <Eric_S_Page@raytheon.com>
Kevin Heifner <heifner_k@ociweb.com>
James Haiar <haiar@ll.mit.edu>
+Pavel Repin <pavel@repin.com>
+Whitney Kew <Whitney.Kew@Invensys.com>
I would particularly like to thank Paul Stephenson, who worked with me
at Ericsson in the early 1990's. Paul devised the recursive Makefile
diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp
index c83faa29252..03186c0c718 100644
--- a/ace/Asynch_Acceptor.cpp
+++ b/ace/Asynch_Acceptor.cpp
@@ -31,9 +31,11 @@ ACE_Asynch_Acceptor<HANDLER>::ACE_Asynch_Acceptor (void)
template <class HANDLER>
ACE_Asynch_Acceptor<HANDLER>::~ACE_Asynch_Acceptor (void)
{
+ //this->asynch_accept_.close ();
+
// Close down the listen socket
- if (this->listen_handle_ != ACE_INVALID_HANDLE)
- ACE_OS::closesocket (this->listen_handle_);
+ // if (this->listen_handle_ != ACE_INVALID_HANDLE)
+ // ACE_OS::closesocket (this->listen_handle_);
}
template <class HANDLER> int
diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp
index 010200327b6..8e2347eed3c 100644
--- a/ace/POSIX_Asynch_IO.cpp
+++ b/ace/POSIX_Asynch_IO.cpp
@@ -181,37 +181,16 @@ ACE_POSIX_Asynch_Operation::open (ACE_Handler &handler,
int
ACE_POSIX_Asynch_Operation::cancel (void)
{
- ACE_Proactor *p = this->proactor () ;
-
- if (!p)
- return -1;
-
- ACE_POSIX_Proactor * p_impl = ACE_dynamic_cast
- (ACE_POSIX_Proactor *,
- p->implementation ());
- if (!p_impl)
+ if (!posix_aiocb_proactor_)
return -1;
- // For ACE_SUN_Proactor and ACE_POSIX_AIOCB_Proactor
- // and ACE_POSIX_SIG_Proactor now !
- // we should call cancel_aio (this->handle_)
- // method to cancel correctly all deferred AIOs
-
- switch (p_impl->get_impl_type ())
+ switch (posix_aiocb_proactor_->get_impl_type ())
{
case ACE_POSIX_Proactor::PROACTOR_SUN:
case ACE_POSIX_Proactor::PROACTOR_AIOCB:
case ACE_POSIX_Proactor::PROACTOR_SIG:
- {
- ACE_POSIX_AIOCB_Proactor * p_impl_aiocb = ACE_dynamic_cast
- (ACE_POSIX_AIOCB_Proactor *,
- p_impl);
-
- if (! p_impl_aiocb)
- return -1;
-
- return p_impl_aiocb->cancel_aio (this->handle_);
- }
+ return posix_aiocb_proactor_->cancel_aio (this->handle_);
+
default:
break;
}
@@ -225,41 +204,29 @@ ACE_POSIX_Asynch_Operation::proactor (void) const
return this->proactor_;
}
-ACE_POSIX_Asynch_Operation::~ACE_POSIX_Asynch_Operation (void)
-{
-}
-
-ACE_POSIX_Asynch_Operation::ACE_POSIX_Asynch_Operation (void)
- : ACE_Asynch_Operation_Impl (),
- handler_ (0),
- handle_ (ACE_INVALID_HANDLE)
-{
-}
-
-// *********************************************************************
-
ACE_POSIX_AIOCB_Proactor *
-ACE_POSIX_AIOCB_Asynch_Operation::posix_proactor (void) const
+ACE_POSIX_Asynch_Operation::posix_proactor (void) const
{
return this->posix_aiocb_proactor_;
}
-ACE_POSIX_AIOCB_Asynch_Operation::ACE_POSIX_AIOCB_Asynch_Operation (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
- : ACE_Asynch_Operation_Impl (),
- ACE_POSIX_Asynch_Operation (),
- posix_aiocb_proactor_ (posix_aiocb_proactor)
+int
+ACE_POSIX_Asynch_Operation::register_and_start_aio (ACE_POSIX_Asynch_Result *result,
+ int op)
{
+ return this->posix_proactor ()->register_and_start_aio (result, op);
}
-ACE_POSIX_AIOCB_Asynch_Operation::~ACE_POSIX_AIOCB_Asynch_Operation (void)
+ACE_POSIX_Asynch_Operation::~ACE_POSIX_Asynch_Operation (void)
{
}
-int
-ACE_POSIX_AIOCB_Asynch_Operation::register_and_start_aio (ACE_POSIX_Asynch_Result *result,
- int op)
+ACE_POSIX_Asynch_Operation::ACE_POSIX_Asynch_Operation (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ : ACE_Asynch_Operation_Impl (),
+ handler_ (0),
+ handle_ (ACE_INVALID_HANDLE),
+ posix_aiocb_proactor_ (posix_aiocb_proactor)
{
- return this->posix_proactor ()->register_and_start_aio (result, op);
}
// *********************************************************************
@@ -400,15 +367,15 @@ ACE_POSIX_Asynch_Read_Stream_Result::post_completion (ACE_Proactor_Impl *proacto
// ************************************************************
-ACE_POSIX_AIOCB_Asynch_Read_Stream::ACE_POSIX_AIOCB_Asynch_Read_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Read_Stream::ACE_POSIX_Asynch_Read_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Stream_Impl (),
- ACE_POSIX_AIOCB_Asynch_Operation (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Operation (posix_aiocb_proactor)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
+ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
u_long bytes_to_read,
const void *act,
int priority,
@@ -427,13 +394,6 @@ ACE_POSIX_AIOCB_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
signal_number),
-1);
- // we do not need shared_read anymore
- //ssize_t return_val = this->shared_read (result);
-
- // try to start read
- // we will setup aio_sigevent later
- // in ACE_POSIX_AIOCB/SIG_Proactor::register_and_start_aio ()
-
ssize_t return_val = this->register_and_start_aio (result, 0);
if (return_val == -1)
@@ -442,26 +402,16 @@ ACE_POSIX_AIOCB_Asynch_Read_Stream::read (ACE_Message_Block &message_block,
return return_val;
}
-ACE_POSIX_AIOCB_Asynch_Read_Stream::~ACE_POSIX_AIOCB_Asynch_Read_Stream (void)
+ACE_POSIX_Asynch_Read_Stream::~ACE_POSIX_Asynch_Read_Stream (void)
{
}
-//int
-//ACE_POSIX_AIOCB_Asynch_Read_Stream::shared_read (ACE_POSIX_Asynch_Read_Stream_Result *result)
-//{
-//
-// result->aio_sigevent.sigev_notify = SIGEV_NONE;
-//
-// // try start read
-// return register_and_start_aio (result, 0);
-//}
-
// Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominance warnings. They route
// the call to the ACE_POSIX_Asynch_Operation base class.
int
-ACE_POSIX_AIOCB_Asynch_Read_Stream::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Read_Stream::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
@@ -473,13 +423,13 @@ ACE_POSIX_AIOCB_Asynch_Read_Stream::open (ACE_Handler &handler,
}
int
-ACE_POSIX_AIOCB_Asynch_Read_Stream::cancel (void)
+ACE_POSIX_Asynch_Read_Stream::cancel (void)
{
return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Read_Stream::proactor (void) const
+ACE_POSIX_Asynch_Read_Stream::proactor (void) const
{
return ACE_POSIX_Asynch_Operation::proactor ();
}
@@ -623,15 +573,15 @@ ACE_POSIX_Asynch_Write_Stream_Result::post_completion (ACE_Proactor_Impl *proact
// *********************************************************************
-ACE_POSIX_AIOCB_Asynch_Write_Stream::ACE_POSIX_AIOCB_Asynch_Write_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Write_Stream::ACE_POSIX_Asynch_Write_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Stream_Impl (),
- ACE_POSIX_AIOCB_Asynch_Operation (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Operation (posix_aiocb_proactor)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
+ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
u_long bytes_to_write,
const void *act,
int priority,
@@ -649,13 +599,6 @@ ACE_POSIX_AIOCB_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
signal_number),
-1);
- // we do not need shared_write anymore
- //ssize_t return_val = this->shared_write (result);
-
- // try to start write
- // we will setup aio_sigevent later
- // in ACE_POSIX_AIOCB/SIG_Proactor::register_and_start_aio ()
-
ssize_t return_val = this->register_and_start_aio (result, 1);
if (return_val == -1)
@@ -664,26 +607,17 @@ ACE_POSIX_AIOCB_Asynch_Write_Stream::write (ACE_Message_Block &message_block,
return return_val;
}
-ACE_POSIX_AIOCB_Asynch_Write_Stream::~ACE_POSIX_AIOCB_Asynch_Write_Stream (void)
+ACE_POSIX_Asynch_Write_Stream::~ACE_POSIX_Asynch_Write_Stream (void)
{
}
-//int
-//ACE_POSIX_AIOCB_Asynch_Write_Stream::shared_write (ACE_POSIX_Asynch_Write_Stream_Result *result)
-//{
-//
-// result->aio_sigevent.sigev_notify = SIGEV_NONE;
-//
-// // try start write
-// return register_and_start_aio (result, 1);
-//}
// Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominance warnings. They route
// the call to the ACE_POSIX_Asynch_Operation base class.
int
-ACE_POSIX_AIOCB_Asynch_Write_Stream::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Write_Stream::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
@@ -695,20 +629,19 @@ ACE_POSIX_AIOCB_Asynch_Write_Stream::open (ACE_Handler &handler,
}
int
-ACE_POSIX_AIOCB_Asynch_Write_Stream::cancel (void)
+ACE_POSIX_Asynch_Write_Stream::cancel (void)
{
return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Write_Stream::proactor (void) const
+ACE_POSIX_Asynch_Write_Stream::proactor (void) const
{
return ACE_POSIX_Asynch_Operation::proactor ();
}
// *********************************************************************
-
ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result (ACE_Handler &handler,
ACE_HANDLE handle,
ACE_Message_Block &message_block,
@@ -861,16 +794,16 @@ ACE_POSIX_Asynch_Read_File_Result::post_completion (ACE_Proactor_Impl *proactor)
// *********************************************************************
-ACE_POSIX_AIOCB_Asynch_Read_File::ACE_POSIX_AIOCB_Asynch_Read_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Read_File::ACE_POSIX_Asynch_Read_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Stream_Impl (),
ACE_Asynch_Read_File_Impl (),
- ACE_POSIX_AIOCB_Asynch_Read_Stream (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Read_Stream (posix_aiocb_proactor)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Read_File::read (ACE_Message_Block &message_block,
+ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
u_long bytes_to_read,
u_long offset,
u_long offset_high,
@@ -892,7 +825,6 @@ ACE_POSIX_AIOCB_Asynch_Read_File::read (ACE_Message_Block &message_block,
signal_number),
-1);
- //ssize_t return_val = this->shared_read (result);
ssize_t return_val = this->register_and_start_aio (result, 0);
if (return_val == -1)
@@ -901,18 +833,18 @@ ACE_POSIX_AIOCB_Asynch_Read_File::read (ACE_Message_Block &message_block,
return return_val;
}
-ACE_POSIX_AIOCB_Asynch_Read_File::~ACE_POSIX_AIOCB_Asynch_Read_File (void)
+ACE_POSIX_Asynch_Read_File::~ACE_POSIX_Asynch_Read_File (void)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Read_File::read (ACE_Message_Block &message_block,
+ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block,
u_long bytes_to_read,
const void *act,
int priority,
int signal_number)
{
- return ACE_POSIX_AIOCB_Asynch_Read_Stream::read (message_block,
+ return ACE_POSIX_Asynch_Read_Stream::read (message_block,
bytes_to_read,
act,
priority,
@@ -924,7 +856,7 @@ ACE_POSIX_AIOCB_Asynch_Read_File::read (ACE_Message_Block &message_block,
// the call to the ACE_POSIX_Asynch_Operation base class.
int
-ACE_POSIX_AIOCB_Asynch_Read_File::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Read_File::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
@@ -936,13 +868,13 @@ ACE_POSIX_AIOCB_Asynch_Read_File::open (ACE_Handler &handler,
}
int
-ACE_POSIX_AIOCB_Asynch_Read_File::cancel (void)
+ACE_POSIX_Asynch_Read_File::cancel (void)
{
return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Read_File::proactor (void) const
+ACE_POSIX_Asynch_Read_File::proactor (void) const
{
return ACE_POSIX_Asynch_Operation::proactor ();
}
@@ -1101,16 +1033,16 @@ ACE_POSIX_Asynch_Write_File_Result::post_completion (ACE_Proactor_Impl *proactor
// *********************************************************************
-ACE_POSIX_AIOCB_Asynch_Write_File::ACE_POSIX_AIOCB_Asynch_Write_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Write_File::ACE_POSIX_Asynch_Write_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Stream_Impl (),
ACE_Asynch_Write_File_Impl (),
- ACE_POSIX_AIOCB_Asynch_Write_Stream (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Write_Stream (posix_aiocb_proactor)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Write_File::write (ACE_Message_Block &message_block,
+ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
u_long bytes_to_write,
u_long offset,
u_long offset_high,
@@ -1132,7 +1064,6 @@ ACE_POSIX_AIOCB_Asynch_Write_File::write (ACE_Message_Block &message_block,
signal_number),
-1);
- //ssize_t return_val = this->shared_write (result);
ssize_t return_val = this->register_and_start_aio (result, 1);
if (return_val == -1)
@@ -1141,18 +1072,18 @@ ACE_POSIX_AIOCB_Asynch_Write_File::write (ACE_Message_Block &message_block,
return return_val;
}
-ACE_POSIX_AIOCB_Asynch_Write_File::~ACE_POSIX_AIOCB_Asynch_Write_File (void)
+ACE_POSIX_Asynch_Write_File::~ACE_POSIX_Asynch_Write_File (void)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Write_File::write (ACE_Message_Block &message_block,
+ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block,
u_long bytes_to_write,
const void *act,
int priority,
int signal_number)
{
- return ACE_POSIX_AIOCB_Asynch_Write_Stream::write (message_block,
+ return ACE_POSIX_Asynch_Write_Stream::write (message_block,
bytes_to_write,
act,
priority,
@@ -1164,7 +1095,7 @@ ACE_POSIX_AIOCB_Asynch_Write_File::write (ACE_Message_Block &message_block,
// the call to the ACE_POSIX_Asynch_Operation base class.
int
-ACE_POSIX_AIOCB_Asynch_Write_File::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Write_File::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
@@ -1176,13 +1107,13 @@ ACE_POSIX_AIOCB_Asynch_Write_File::open (ACE_Handler &handler,
}
int
-ACE_POSIX_AIOCB_Asynch_Write_File::cancel (void)
+ACE_POSIX_Asynch_Write_File::cancel (void)
{
return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Write_File::proactor (void) const
+ACE_POSIX_Asynch_Write_File::proactor (void) const
{
return ACE_POSIX_Asynch_Operation::proactor ();
}
@@ -1330,144 +1261,182 @@ ACE_POSIX_Asynch_Accept_Result::post_completion (ACE_Proactor_Impl *proactor)
// *********************************************************************
-class ACE_Export ACE_POSIX_Asynch_Accept_Handler : public ACE_Event_Handler
+ACE_POSIX_Asynch_Accept::ACE_POSIX_Asynch_Accept (ACE_POSIX_AIOCB_Proactor * posix_proactor)
+ : ACE_Asynch_Operation_Impl (),
+ ACE_Asynch_Accept_Impl (),
+ ACE_POSIX_Asynch_Operation (posix_proactor),
+ flg_open_ (0),
+ task_lock_count_ (0)
{
- // = TITLE
- // For the POSIX implementation this class is common
- // for all Proactors (AIOCB/SIG/SUN)
- //
- // = DESCRIPTION
- //
-
-public:
- ~ACE_POSIX_Asynch_Accept_Handler (void);
- // Destructor.
-
- ACE_POSIX_Asynch_Accept_Handler (ACE_Reactor* reactor,
- ACE_POSIX_Proactor *posix_proactor);
- // Constructor. Give the reactor so that it can activate/deactivate
- // the handlers. Give also the proactor used here, so that the
- // handler can send the <POSIX_Asynch_Accept> result block through
- // <post_completion>.
-
- int cancel_uncompleted (int flg_notify);
- // flg_notify points whether or not we should send notification about
- // canceled accepts
-
-
- int register_accept_call (ACE_POSIX_Asynch_Accept_Result* result);
- // Worker method for registering this <accept> call with the local
- // handler. This method obtains lock to access the shared the queues.
-
- ACE_POSIX_Asynch_Accept_Result* deregister_accept_call (void);
- // Method for deregistering.
-
- int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
- // Called when accept event comes up on <listen_hanlde>
+}
-protected:
- ACE_Reactor* reactor_;
- // Reactor used by the Asynch_Accept. We need this here to enable
- // and disable the <handle> now and then, depending on whether any
- // <accept> is pending or no.
-
- ACE_POSIX_Proactor *posix_proactor_;
- // POSIX_Proactor implementation.
-
- ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result*> result_queue_;
- // Queue of Result pointers that correspond to all the <accept>'s
- // pending.
-
- ACE_SYNCH_MUTEX lock_;
- // The lock to protect the result queue which is shared. The queue
- // is updated by main thread in the register function call and
- // through the auxillary thread in the deregister fun. So let us
- // mutex it.
-};
+ACE_POSIX_Asynch_Accept::~ACE_POSIX_Asynch_Accept (void)
+{
+ this->close ();
+}
-// *********************************************************************
+ACE_Proactor *
+ACE_POSIX_Asynch_Accept::proactor (void) const
+{
+ return ACE_POSIX_Asynch_Operation::proactor ();
+}
-ACE_POSIX_Asynch_Accept_Handler::ACE_POSIX_Asynch_Accept_Handler (ACE_Reactor* reactor,
- ACE_POSIX_Proactor *posix_proactor)
- : reactor_ (reactor),
- posix_proactor_ (posix_proactor)
+ACE_HANDLE
+ACE_POSIX_Asynch_Accept::get_handle (void) const
{
- ACE_TRACE ("ACE_POSIX_Asynch_Accept_Handler::ctor");
+ return this->handle_;
}
-ACE_POSIX_Asynch_Accept_Handler::~ACE_POSIX_Asynch_Accept_Handler (void)
+void
+ACE_POSIX_Asynch_Accept::set_handle (ACE_HANDLE handle)
{
- ACE_TRACE ("ACE_POSIX_Asynch_Accept_Handler::~ACE_POSIX_Asynch_Accept_Handler");
+ ACE_ASSERT (handle_ == ACE_INVALID_HANDLE);
+ this->handle_ = handle;
}
int
-ACE_POSIX_Asynch_Accept_Handler::register_accept_call (ACE_POSIX_Asynch_Accept_Result* result)
+ACE_POSIX_Asynch_Accept::open (ACE_Handler &handler,
+ ACE_HANDLE handle,
+ const void *completion_key,
+ ACE_Proactor *proactor)
{
- // The queue is updated by main thread in the register function call
- // and thru the auxillary thread in the deregister fun. So let us
- // mutex it.
+ ACE_TRACE (ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::open\n"));
+
+ int result = 0;
+
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
- // Insert this result to the queue.
- int insert_result = this->result_queue_.enqueue_tail (result);
- if (insert_result == -1)
+ // If we are already opened, we could not create a new handler
+ // without closing the previous.
+
+ if (this->flg_open_ != 0)
ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:ACE_POSIX_Asynch_Accept_Handler::register_accept_call failed\n"),
+ ACE_LIB_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::open:")
+ ACE_LIB_TEXT("acceptor already open \n")),
-1);
+
+ result = ACE_POSIX_Asynch_Operation::open (handler,
+ handle,
+ completion_key,
+ proactor);
+ if (result == -1)
+ return result;
- // If this is the only item, then it means there the set was empty
- // before. So enable the <handle> in the reactor.
- if (this->result_queue_.size () == 1)
+ flg_open_ = 1;
+
+ task_lock_count_++;
+
+ // At this moment asynch_accept_task does not know about us, so we
+ // can lock task's token with our lock_ locked. In all other cases
+ // we should release our lock_ before calling task's methods to
+ // avoid deadlock
+
+ ACE_POSIX_Asynch_Accept_Task & task =
+ this->posix_proactor()->get_asynch_accept_task();
+
+ result = task.register_acceptor (this, ACE_Event_Handler::ACCEPT_MASK);
+
+ task_lock_count_-- ;
+
+ if (result < 0)
{
- int return_val = this->reactor_->resume_handler (result->listen_handle ());
- if (return_val == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:ACE_POSIX_Asynch_Accept_Handler::register_accept_call: "
- "Reactor::resume_handler failed\n"),
- -1);
+
+ this->flg_open_= 0;
+ this->handle_ = ACE_INVALID_HANDLE;
+
+ return -1 ;
}
return 0;
}
-// @@ We could have a queue where the <result> objects are arranged
-// according to the priority. This will help us to demux the accept
-// completions based on the priority. (Alex).
-
-ACE_POSIX_Asynch_Accept_Result *
-ACE_POSIX_Asynch_Accept_Handler::deregister_accept_call (void)
+int
+ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
+ u_long bytes_to_read,
+ ACE_HANDLE accept_handle,
+ const void *act,
+ int priority,
+ int signal_number)
{
- // The queue is updated by main thread in the register function call and
- // thru the auxillary thread in the deregister fun. So let us mutex
- // it.
- ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
+ ACE_TRACE (ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::accept\n") );
- // Get the first item (result ptr) from the Queue.
- ACE_POSIX_Asynch_Accept_Result* result = 0;
- if (this->result_queue_.dequeue_head (result) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:(%P | %t):%p\n",
- "ACE_POSIX_Asynch_Accept_Handler::"
- "deregister_accept_call:dequeueing failed"),
- 0);
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
- // ACE_ASSERT (result != 0);
+ if (this->flg_open_ == 0 )
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::accept")
+ ACE_LIB_TEXT("acceptor was not opened before\n")),
+ -1);
- // Disable the <handle> in the reactor if no <accept>'s are pending.
- if (this->result_queue_.size () == 0)
- {
- if (this->reactor_->suspend_handler (result->listen_handle ()) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:(%P | %t):%p\n",
- "ACE_POSIX_Asynch_Accept_Handler::"
- "deregister_accept_call:suspend handler failed"),
- 0);
- }
+ // Sanity check: make sure that enough space has been allocated by
+ // the caller.
+ size_t address_size = sizeof (sockaddr_in) + sizeof (sockaddr);
+ size_t space_in_use = message_block.wr_ptr () - message_block.base ();
+ size_t total_size = message_block.size ();
+ size_t available_space = total_size - space_in_use;
+ size_t space_needed = bytes_to_read + 2 * address_size;
+
+ if (available_space < space_needed)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("Buffer too small\n")),
+ -1);
+
+ // Common code for both WIN and POSIX.
+ // Create future Asynch_Accept_Result
+ ACE_POSIX_Asynch_Accept_Result *result = 0;
+ ACE_NEW_RETURN (result,
+ ACE_POSIX_Asynch_Accept_Result (*this->handler_,
+ this->handle_,
+ accept_handle,
+ message_block,
+ bytes_to_read,
+ act,
+ this->posix_proactor()->get_handle (),
+ priority,
+ signal_number),
+ -1);
- // Return the result pointer.
- return result;
-}
+ // Enqueue result
+ if (this->result_queue_.enqueue_tail (result) == -1)
+ {
+ delete result; // to avoid memory leak
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT("%N:%l:ACE_POSIX_Asynch_Accept::accept:")
+ ACE_LIB_TEXT("enqueue accept call failed\n")),
+ -1);
+ }
+
+ if (this->result_queue_.size () > 1)
+ return 0;
+
+ task_lock_count_ ++;
+ }
+
+ // If this is the only item, then it means there the set was empty
+ // before. So enable the <handle> in the reactor.
+
+ ACE_POSIX_Asynch_Accept_Task & task =
+ this->posix_proactor()->get_asynch_accept_task();
+
+ int rc_task = task.resume_acceptor (this);
+
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
+ task_lock_count_ --;
+
+ if (rc_task == -2 && task_lock_count_ == 0) // task is closing
+ task.unlock_finish ();
+
+ }
+
+ if (rc_task < 0)
+ return -1;
+
+ return 0;
+}
//@@ New method cancel_uncompleted
// It performs cancellation of all pending requests
@@ -1482,9 +1451,9 @@ ACE_POSIX_Asynch_Accept_Handler::deregister_accept_call (void)
//
int
-ACE_POSIX_Asynch_Accept_Handler::cancel_uncompleted (int flg_notify)
+ACE_POSIX_Asynch_Accept::cancel_uncompleted (int flg_notify)
{
- ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+ ACE_TRACE (ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::cancel_uncompleted\n"));
int retval = 0;
@@ -1497,56 +1466,221 @@ ACE_POSIX_Asynch_Accept_Handler::cancel_uncompleted (int flg_notify)
if (result == 0)
break;
- this->reactor_->suspend_handler (result->listen_handle ());
+ if (this->flg_open_==0 || flg_notify == 0) //if we should not notify
+ delete result ; // we have to delete result
+ else //else notify as any cancelled AIO
+ {
+ // Store the new handle.
+ result->aio_fildes = ACE_INVALID_HANDLE ;
+ result->set_bytes_transferred (0);
+ result->set_error (ECANCELED);
+
+ if (this->posix_proactor()->post_completion (result) == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT("Error:(%P | %t):%p\n"),
+ ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::")
+ ACE_LIB_TEXT("cancel_uncompleted:<post_completion> failed")
+ ));
+ }
+ }
+ return retval;
+}
+
+int
+ACE_POSIX_Asynch_Accept::cancel (void)
+{
+ ACE_TRACE (ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::cancel\n"));
+
+ //We are not really ACE_POSIX_Asynch_Operation
+ //so we could not call ::aiocancel ()
+ // or just write
+ //return ACE_POSIX_Asynch_Operation::cancel ();
+ //We delegate real cancelation to cancel_uncompleted (1)
+
+ int rc = -1 ; // ERRORS
+
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
+ int num_cancelled = cancel_uncompleted (flg_open_);
+
+ if (num_cancelled == 0)
+ rc = 1 ; // AIO_ALLDONE
+ else if (num_cancelled > 0)
+ rc = 0 ; // AIO_CANCELED
+
+ if (this->flg_open_ == 0)
+ return rc ;
+
+ task_lock_count_ ++;
+ }
+
+ ACE_POSIX_Asynch_Accept_Task & task =
+ this->posix_proactor()->get_asynch_accept_task();
- if (! flg_notify) //if we should not notify
- delete result ; // we have to delete result
- else //else notify as any cancelled AIO
+ int rc_task = task.suspend_acceptor (this);
+
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
+ task_lock_count_--;
+
+ if (rc_task == -2 && task_lock_count_ == 0) // task is closing
+ task.unlock_finish ();
+
+ }
+
+ return rc;
+}
+
+int
+ACE_POSIX_Asynch_Accept::close ()
+{
+ ACE_TRACE (ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::close\n"));
+
+ // 1. It performs cancellation of all pending requests
+ // 2. Removes itself from Reactor (ACE_POSIX_Asynch_Accept_Task)
+ // 3. close the socket
+ //
+ // Parameter flg_notify can be
+ // 0 - don't send notifications about canceled accepts
+ // !0 - notify user about canceled accepts
+ // according POSIX standards we should receive notifications
+ // on canceled AIO requests
+ //
+ // Return codes : 0 - OK ,
+ // -1 - Errors
+
+
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
+ this->cancel_uncompleted (flg_open_);
+
+ if (this->flg_open_ == 0)
{
- // Store the new handle.
- result->aio_fildes = ACE_INVALID_HANDLE ;
- result->set_bytes_transferred (0);
- result->set_error (ECANCELED);
+ if (this->handle_ != ACE_INVALID_HANDLE)
+ {
+ ACE_OS::closesocket (this->handle_);
+ this->handle_=ACE_INVALID_HANDLE;
+ }
+ return 0;
+ }
- if (this->posix_proactor_->post_completion (result) == -1)
- ACE_ERROR ((LM_ERROR,
- "Error:(%P | %t):%p\n",
- "ACE_POSIX_Asynch_Accept_Handler::"
- "cancel_uncompleted:<post_completion> failed"));
+ task_lock_count_++;
+ }
+
+ ACE_POSIX_Asynch_Accept_Task & task =
+ this->posix_proactor()->get_asynch_accept_task();
+
+ int rc_task = task.remove_acceptor (this);
+
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1));
+
+ task_lock_count_--;
+
+ if (rc_task == -2 && task_lock_count_ == 0) // task is closing
+ task.unlock_finish ();
+
+ if (this->handle_ != ACE_INVALID_HANDLE)
+ {
+ ACE_OS::closesocket (this->handle_);
+ this->handle_=ACE_INVALID_HANDLE;
}
- }
- return retval;
+ this->flg_open_=0;
+ }
+
+ return 0;
}
+int
+ACE_POSIX_Asynch_Accept::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask)
+{
+ ACE_TRACE(ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::handle_close\n"));
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
+
+ // handle_close is called only in one case :
+ // when Asynch_accept_task is closing (i.e. proactor destructor)
+
+ // In all other cases we deregister ourself with
+ // ACE_Event_Handler::DONT_CALL mask
+
+ this->cancel_uncompleted (0);
+
+ this->flg_open_ = 0;
+
+ // it means other thread is waiting for reactor token_
+ if (task_lock_count_ > 0)
+ {
+ ACE_POSIX_Asynch_Accept_Task & task =
+ this->posix_proactor()->get_asynch_accept_task();
+
+ task.lock_finish ();
+ }
+
+ return 0;
+}
int
-ACE_POSIX_Asynch_Accept_Handler::handle_input (ACE_HANDLE /* fd */)
+ACE_POSIX_Asynch_Accept::handle_input (ACE_HANDLE /* fd */)
{
+ ACE_TRACE (ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::handle_input\n"));
+
// An <accept> has been sensed on the <listen_handle>. We should be
// able to just go ahead and do the <accept> now on this <fd>. This
// should be the same as the <listen_handle>.
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0));
+
+ ACE_POSIX_Asynch_Accept_Result* result = 0;
+
// Deregister this info pertaining to this <accept> call.
- ACE_POSIX_Asynch_Accept_Result* result = this->deregister_accept_call ();
- if (result == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:(%P | %t):%p\n",
- "ACE_POSIX_AIOCB_Asynch_Accept_Handler::"
- "handle_input:deregister_accept_call failed"),
- -1);
+ if (this->result_queue_.dequeue_head (result) != 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT("%N:%l:(%P | %t):%p\n"),
+ ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::handle_input:")
+ ACE_LIB_TEXT(" dequeueing failed")
+ ));
+
+ // Disable the <handle> in the reactor if no <accept>'s are pending.
+
+ // we allow the following sequence of locks :
+ // reactor::token , then our mutex lock_
+ // to avoid deadlock prohibited reverse sequence
+
+ if (this->result_queue_.size () == 0)
+ {
+ ACE_POSIX_Asynch_Accept_Task & task =
+ this->posix_proactor()->get_asynch_accept_task();
+
+ task.suspend_acceptor (this);
+ }
// Issue <accept> now.
// @@ We shouldnt block here since we have already done poll/select
// thru reactor. But are we sure?
- ACE_HANDLE new_handle = ACE_OS::accept (result->listen_handle (), 0, 0);
+
+ ACE_HANDLE new_handle = ACE_OS::accept (this->handle_, 0, 0);
+
+
+ if (result == 0) // there is nobody to notify
+ {
+ ACE_OS::closesocket (new_handle);
+ return 0;
+ }
+
+
if (new_handle == ACE_INVALID_HANDLE)
{
result->set_error(errno);
ACE_ERROR ((LM_ERROR,
- "%N:%l:(%P | %t):%p\n",
- "ACE_POSIX_AIOCB_Asynch_Accept_Handler::"
- "handle_input:<accept> system call failed"));
+ ACE_LIB_TEXT("%N:%l:(%P | %t):%p\n"),
+ ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::handle_input: ")
+ ACE_LIB_TEXT(" <accept> system call failed")
+ ));
// Notify client as usual, "AIO" finished with errors
}
@@ -1556,217 +1690,130 @@ ACE_POSIX_Asynch_Accept_Handler::handle_input (ACE_HANDLE /* fd */)
// Notify the main process about this completion
// Send the Result through the notification pipe.
- if (this->posix_proactor_->post_completion (result) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Error:(%P | %t):%p\n",
- "ACE_POSIX_AIOCB_Asynch_Accept_Handler::"
- "handle_input:<post_completion> failed"),
- -1);
-
+ if (this->posix_proactor()->post_completion (result) == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT("Error:(%P | %t):%p\n"),
+ ACE_LIB_TEXT("ACE_POSIX_Asynch_Accept::handle_input: ")
+ ACE_LIB_TEXT(" <post_completion> failed")
+ ));
+
return 0;
}
-
// *********************************************************************
-ACE_POSIX_Asynch_Accept::ACE_POSIX_Asynch_Accept (ACE_POSIX_Proactor *posix_proactor)
- : ACE_Asynch_Operation_Impl (),
- ACE_Asynch_Accept_Impl (),
- ACE_POSIX_Asynch_Operation (),
- accept_handler_ (0),
- grp_id_(-1), //thread not spawn
- posix_proactor_ (posix_proactor) //save concrete proactor impl.
+ACE_POSIX_Asynch_Accept_Task::ACE_POSIX_Asynch_Accept_Task()
+ : flg_active_ (0),
+ select_reactor_(), // should be initialized before reactor_
+ reactor_ (& select_reactor_, 0), // don't delete implementation
+ token_ (select_reactor_.lock()), // we can use reactor token
+ finish_count_(0)
{
}
-int
-ACE_POSIX_Asynch_Accept::accept (ACE_Message_Block &message_block,
- u_long bytes_to_read,
- ACE_HANDLE accept_handle,
- const void *act,
- int priority,
- int signal_number)
-{
- // Sanity check: make sure that enough space has been allocated by
- // the caller.
- size_t address_size = sizeof (sockaddr_in) + sizeof (sockaddr);
- size_t space_in_use = message_block.wr_ptr () - message_block.base ();
- size_t total_size = message_block.size ();
- size_t available_space = total_size - space_in_use;
- size_t space_needed = bytes_to_read + 2 * address_size;
- if (available_space < space_needed)
- ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("Buffer too small\n")), -1);
-
- // Common code for both WIN and POSIX.
- ACE_POSIX_Asynch_Accept_Result *result = 0;
- ACE_NEW_RETURN (result,
- ACE_POSIX_Asynch_Accept_Result (*this->handler_,
- this->handle_,
- accept_handle,
- message_block,
- bytes_to_read,
- act,
- this->posix_proactor_->get_handle (),
- priority,
- signal_number),
- -1);
-
- // Register this <accept> call with the local handler.
- if (this->accept_handler_->register_accept_call (result) == -1)
- return -1;
-
- return 0;
+ACE_POSIX_Asynch_Accept_Task::~ACE_POSIX_Asynch_Accept_Task()
+{
+ stop();
}
-int
-ACE_POSIX_Asynch_Accept::open (ACE_Handler &handler,
- ACE_HANDLE handle,
- const void *completion_key,
- ACE_Proactor *proactor)
+int
+ACE_POSIX_Asynch_Accept_Task::start ()
{
- // check for non zero accept_handler_
- // we could not create a new handler without closing the previous
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
- if (this->accept_handler_ != 0)
+ if (this->flg_active_)
ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:ACE_POSIX_Asynch_Accept::open:"
- "accept_handler_ not null\n"),
- -1);
-
-
- int result = ACE_POSIX_Asynch_Operation::open (handler,
- handle,
- completion_key,
- proactor);
- if (result == -1)
- return result;
+ ACE_LIB_TEXT ("%N:%l:%p\n"),
+ ACE_LIB_TEXT ("ACE_POSIX_Asynch_Accept_Task::start already started")),
+ -1);
- // Init the Asynch_Accept_Handler now. It needs to keep Proactor
- // also with it.
- ACE_NEW_RETURN (this->accept_handler_,
- ACE_POSIX_Asynch_Accept_Handler (&this->reactor_,
- this->posix_proactor_),
- -1);
-
- // Register the handle with the reactor.
- int return_val = this->reactor_.register_handler (this->handle_,
- this->accept_handler_,
- ACE_Event_Handler::ACCEPT_MASK);
- if (return_val == -1)
+ if (this->reactor_.initialized () == 0)
ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:Reactor::register_handler failed\n"),
- -1);
+ ACE_LIB_TEXT ("%N:%l:%p\n"),
+ ACE_LIB_TEXT ("ACE_POSIX_Asynch_Accept_Task::start reactor is not initialized")),
+ -1);
- // Suspend the <handle> now. Enable only when the <accept> is issued
- // by the application.
- return_val = this->reactor_.suspend_handler (this->handle_);
- if (return_val == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:Reactor::suspend_handler failed\n"),
- -1);
- // Spawn the thread. It is the only thread we are going to have. It
- // will do the <handle_events> on the reactor.
- // save group id of the created thread
-
- grp_id_ = ACE_Thread_Manager::instance ()->spawn (ACE_POSIX_Asynch_Accept::thread_function,
- ACE_reinterpret_cast (void *, &this->reactor_));
- if (grp_id_ == -1)
+ if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0 )
ACE_ERROR_RETURN ((LM_ERROR,
- "%N:%l:Thread_Manager::spawn failed\n"),
- -1);
+ ACE_LIB_TEXT ("%N:%l:%p\n"),
+ ACE_LIB_TEXT ("ACE_POSIX_Asynch_Accept_Task::start failed")),
+ -1);
+ this->flg_active_ = 1;
return 0;
}
-ACE_POSIX_Asynch_Accept::~ACE_POSIX_Asynch_Accept (void)
+int
+ACE_POSIX_Asynch_Accept_Task::stop ()
{
- this->close (0); // not send notifications to user
-}
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
-int
-ACE_POSIX_Asynch_Accept::close (int flg_notify)
-{
- // 1. It performs cancellation of all pending requests
- // 2. Stops and waits for the thread we had created
- // 3. Removes accept_handler_ from Reactor
- // 4. Deletes accept_handler_
- // 5. close the socket
- //
- // Parameter flg_notify can be
- // 0 - don't send notifications about canceled accepts
- // !0 - notify user about canceled accepts
- // according POSIX standards we should receive notifications
- // on canceled AIO requests
- //
- // Return codes : 0 - OK ,
- // -1 - Errors
+ if (this->flg_active_ == 0 ) // already stopped
+ return 0;
- if (this->accept_handler_)
- this->accept_handler_->cancel_uncompleted (flg_notify);
+ reactor_.end_reactor_event_loop ();
+ }
- //stop and wait for the thread
+ int rc = this->wait ();
- if (grp_id_ != -1)
- {
- reactor_.end_reactor_event_loop ();
+ if (rc != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:%p\n"),
+ ACE_LIB_TEXT ("ACE_POSIX_Asynch_Accept_Task::stop failed")),
+ -1);
- if (ACE_Thread_Manager::instance ()->wait_grp (grp_id_) ==-1)
- ACE_ERROR ((LM_ERROR,
- "%N:%l:Thread_Manager::wait_grp failed\n"));
- else
- grp_id_ = -1;
- }
- //AL remove and destroy accept_handler_
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
+ this->flg_active_ = 0;
- if (this->accept_handler_ != 0)
- {
- this->reactor_.remove_handler
- (this->accept_handler_,
- ACE_Event_Handler::ALL_EVENTS_MASK
- | ACE_Event_Handler::DONT_CALL);
-
- delete this->accept_handler_ ;
- this->accept_handler_ = 0 ;
- }
-
- // It looks like a good place to close listen handle here.
- // But I am not sure with compatibility with the old programs
- // You can comment the closure of the socket
+ if (this->reactor_.initialized ())
+ this->reactor_.close();
- if (this->handle_ != ACE_INVALID_HANDLE)
- {
- ACE_OS::closesocket (this->handle_);
- this->handle_=ACE_INVALID_HANDLE;
- }
+ while (finish_count_ > 0)
+ {
+ ace_mon.release ();
+ finish_event_.wait();
+ ace_mon.acquire ();
+ finish_event_.reset ();
+ }
+ }
+
+ return rc;
+}
+
+int
+ACE_POSIX_Asynch_Accept_Task::lock_finish ()
+{
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
+ finish_count_ ++;
return 0;
}
-void *
-ACE_POSIX_Asynch_Accept::thread_function (void *arg_reactor)
+int
+ACE_POSIX_Asynch_Accept_Task::unlock_finish ()
{
- // Retrieve the reactor pointer from the argument.
- ACE_Reactor *reactor = ACE_reinterpret_cast (ACE_Reactor *,
- arg_reactor);
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
- // It should be valid Reactor, since we have a reactor_ ,e,ner we
- // are passing only that one here.
- if (reactor == 0)
- ACE_ERROR ((LM_ERROR,
- "%n:%l:Invalid Reactor pointer passed to the thread_function\n",
- 0));
+ finish_count_ --;
- // For this reactor, this thread is the owner.
- reactor->owner (ACE_OS::thr_self ());
+ finish_event_.signal ();
+ return 0;
+}
+
+int
+ACE_POSIX_Asynch_Accept_Task::svc ()
+{
sigset_t RT_signals;
- if (sigemptyset ( & RT_signals ) == -1)
+ if (sigemptyset (& RT_signals) == -1)
ACE_ERROR ((LM_ERROR,
- "Error:(%P | %t):%p\n",
- "sigemptyset failed"));
+ ACE_LIB_TEXT ("Error:(%P | %t):%p\n"),
+ ACE_LIB_TEXT ("sigemptyset failed")));
int member = 0;
@@ -1779,54 +1826,148 @@ ACE_POSIX_Asynch_Accept::thread_function (void *arg_reactor)
}
}
- if (ACE_OS::pthread_sigmask ( SIG_BLOCK, & RT_signals, 0) != 0)
+ if (ACE_OS::pthread_sigmask (SIG_BLOCK, & RT_signals, 0) != 0)
ACE_ERROR ((LM_ERROR,
- "Error:(%P | %t):%p\n",
- "pthread_sigmask failed"));
+ ACE_LIB_TEXT ("Error:(%P | %t):%p\n"),
+ ACE_LIB_TEXT ("pthread_sigmask failed")));
- while (reactor->reactor_event_loop_done () == 0)
- if (reactor->handle_events () == -1)
- return ACE_reinterpret_cast (void *, -1);
+
+
+ reactor_.owner (ACE_Thread::self());
+
+ reactor_.run_reactor_event_loop ();
return 0;
}
-// Methods belong to ACE_POSIX_Asynch_Operation base class. These
-// methods are defined here to avoid dominance warnings. They route
-// the call to the ACE_POSIX_Asynch_Operation base class.
+
int
-ACE_POSIX_Asynch_Accept::cancel (void)
+ACE_POSIX_Asynch_Accept_Task::register_acceptor (ACE_POSIX_Asynch_Accept * posix_accept,
+ ACE_Reactor_Mask mask)
{
- //We are not ACE_POSIX_Asynch_Operation
- //so we could not call ::aiocancel ()
- //We delegate real cancelation to the accept_handler_
- // accept_handler_->cancel_uncompleted (1)
+ // Return codes :
+ // 0 success
+ // -1 reactor errors
+ // -2 task not active
- //return ACE_POSIX_Asynch_Operation::cancel ();
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
- if (this->accept_handler_ == 0)
- return 1 ; // AIO_ALLDONE
+ if (this->flg_active_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::register_acceptor \n")
+ ACE_LIB_TEXT ("task not active \n")),
+ -2);
+
+ // Register the handler with the reactor.
+ int retval = this->reactor_.register_handler (posix_accept->get_handle(),
+ posix_accept,
+ mask);
+
+ if (retval == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::register_acceptor \n")
+ ACE_LIB_TEXT ("register_handler failed \n")),
+ -1);
- //cancel with notifications as POSIX should do
+ // Suspend the <handle> now. Enable only when the <accept> is issued
+ // by the application.
+ retval = this->reactor_.suspend_handler (posix_accept->get_handle());
+ if (retval == -1)
+ {
+ this->reactor_.remove_handler (posix_accept,
+ ACE_Event_Handler::ALL_EVENTS_MASK
+ | ACE_Event_Handler::DONT_CALL);
+
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::register_acceptor \n")
+ ACE_LIB_TEXT ("suspend_handler failed \n")),
+ -1);
+ }
- int retval = this->accept_handler_->cancel_uncompleted (1);
+ return 0;
+}
- //retval contains now the number of canceled requests
-
- if (retval == 0)
- return 1 ; // AIO_ALLDONE
+int
+ACE_POSIX_Asynch_Accept_Task::remove_acceptor (ACE_POSIX_Asynch_Accept * posix_accept)
+{
+ // Return codes :
+ // 0 success
+ // -1 reactor errors
+ // -2 task not active
- if (retval > 0)
- return 0; // AIO_CANCELED
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
- return -1;
+ if (this->flg_active_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::remove_acceptor \n")
+ ACE_LIB_TEXT ("task not active \n")),
+ -2);
+
+ int retval = this->reactor_.remove_handler (posix_accept,
+ ACE_Event_Handler::ALL_EVENTS_MASK
+ | ACE_Event_Handler::DONT_CALL);
+ if (retval == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::remove_acceptor \n")
+ ACE_LIB_TEXT ("remove_handler failed \n")),
+ -1);
+
+ return 0;
}
-ACE_Proactor *
-ACE_POSIX_Asynch_Accept::proactor (void) const
+int
+ACE_POSIX_Asynch_Accept_Task::suspend_acceptor (ACE_POSIX_Asynch_Accept * posix_accept)
{
- return ACE_POSIX_Asynch_Operation::proactor ();
+ // Return codes :
+ // 0 success
+ // -1 reactor errors
+ // -2 task not active
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
+
+ if (this->flg_active_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::suspend_acceptor \n")
+ ACE_LIB_TEXT ("task not active \n")),
+ -2);
+
+ int retval = this->reactor_.suspend_handler (posix_accept);
+
+ if (retval == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::suspend_acceptor \n")
+ ACE_LIB_TEXT ("suspend_handler failed \n")),
+ -1);
+
+ return 0;
+}
+
+int
+ACE_POSIX_Asynch_Accept_Task::resume_acceptor (ACE_POSIX_Asynch_Accept * posix_accept)
+{
+ // Return codes :
+ // 0 success
+ // -1 reactor errors
+ // -2 task not active
+
+ ACE_MT (ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->token_, -1));
+
+ if (this->flg_active_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::resume_acceptor \n")
+ ACE_LIB_TEXT ("task not active \n")),
+ -2);
+
+ int retval = this->reactor_.resume_handler (posix_accept);
+
+ if (retval == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("%N:%l:ACE_POSIX_Asynch_Accept_Task::resume_acceptor \n")
+ ACE_LIB_TEXT ("resume_handler failed \n")),
+ -1);
+
+ return 0;
}
// *********************************************************************
@@ -2012,19 +2153,24 @@ class ACE_Export ACE_POSIX_Asynch_Transmit_Handler : public ACE_Handler
// = DESCRIPTION
//
// This is a helper class for implementing
- // <ACE_POSIX_Asynch_Transmit_File> in Unix systems. This class
- // abstracts out all the commonalities in the two different
- // POSIX Transmit Handler implementations.
+ // <ACE_POSIX_Asynch_Transmit_File> in Unix systems.
+ //
public:
+ ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor,
+ ACE_POSIX_Asynch_Transmit_File_Result *result);
+ // Constructor. Result pointer will have all the information to do
+ // the file transmission (socket, file, application handler, bytes
+ // to write).
+
virtual ~ACE_POSIX_Asynch_Transmit_Handler (void);
// Destructor.
+ int transmit (void);
+ // Do the transmission. All the info to do the transmission is in
+ // the <result> member.
+
protected:
- ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_Asynch_Transmit_File_Result *result);
- // Constructor. Result pointer will have all the information to do
- // the file transmission (socket, file, application handler, bytes
- // to write).
ACE_POSIX_Asynch_Transmit_File_Result *result_;
// The asynch result pointer made from the initial transmit file
@@ -2053,37 +2199,7 @@ protected:
size_t bytes_transferred_;
// Number of bytes transferred on the stream.
-};
-
-// ************************************************************
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Transmit_Handler : public ACE_POSIX_Asynch_Transmit_Handler
-{
- // = TITLE
- //
- // Auxillary handler for doing <Asynch_Transmit_File> in
- // Unix. <ACE_POSIX_Asynch_Transmit_File> internally uses this.
- //
- // = DESCRIPTION
- //
- // This is a helper class for implementing
- // <ACE_POSIX_Asynch_Transmit_File> in Unix systems.
-
-public:
- ACE_POSIX_AIOCB_Asynch_Transmit_Handler (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor,
- ACE_POSIX_Asynch_Transmit_File_Result *result);
- // Constructor. Result pointer will have all the information to do
- // the file transmission (socket, file, application handler, bytes
- // to write).
-
- virtual ~ACE_POSIX_AIOCB_Asynch_Transmit_Handler (void);
- // Destructor.
-
- int transmit (void);
- // Do the transmission. All the info to do the transmission is in
- // the <result> member.
-
-protected:
virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result);
// This is called when asynchronous writes from the socket complete.
@@ -2093,17 +2209,19 @@ protected:
int initiate_read_file (void);
// Issue asynch read from the file.
- ACE_POSIX_AIOCB_Asynch_Read_File rf_;
+ ACE_POSIX_Asynch_Read_File rf_;
// To read from the file to be transmitted.
- ACE_POSIX_AIOCB_Asynch_Write_Stream ws_;
+ ACE_POSIX_Asynch_Write_Stream ws_;
// Write stream to write the header, trailer and the data.
};
-// *********************************************************************
+// ************************************************************
// Constructor.
-ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_Asynch_Transmit_File_Result *result)
+ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler
+ (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor,
+ ACE_POSIX_Asynch_Transmit_File_Result *result)
: result_ (result),
mb_ (0),
header_act_ (this->HEADER_ACT),
@@ -2111,7 +2229,9 @@ ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler (ACE_POSIX_
trailer_act_ (this->TRAILER_ACT),
file_offset_ (result->offset ()),
file_size_ (0),
- bytes_transferred_ (0)
+ bytes_transferred_ (0),
+ rf_ (posix_aiocb_proactor),
+ ws_ (posix_aiocb_proactor)
{
// Allocate memory for the message block.
ACE_NEW (this->mb_,
@@ -2128,25 +2248,12 @@ ACE_POSIX_Asynch_Transmit_Handler::~ACE_POSIX_Asynch_Transmit_Handler (void)
mb_->release ();
}
-// *********************************************************************
-
-ACE_POSIX_AIOCB_Asynch_Transmit_Handler::ACE_POSIX_AIOCB_Asynch_Transmit_Handler (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor,
- ACE_POSIX_Asynch_Transmit_File_Result *result)
- : ACE_POSIX_Asynch_Transmit_Handler (result),
- rf_ (posix_aiocb_proactor),
- ws_ (posix_aiocb_proactor)
-{
-}
-
-ACE_POSIX_AIOCB_Asynch_Transmit_Handler::~ACE_POSIX_AIOCB_Asynch_Transmit_Handler (void)
-{
-}
// Do the transmission.
// Initiate transmitting the header. When that completes
// handle_write_stream will be called, there start transmitting the file.
int
-ACE_POSIX_AIOCB_Asynch_Transmit_Handler::transmit (void)
+ACE_POSIX_Asynch_Transmit_Handler::transmit (void)
{
// No proactor is given for the <open>'s. Because we are using the
// concrete implementations of the Asynch_Operations, and we have
@@ -2183,7 +2290,7 @@ ACE_POSIX_AIOCB_Asynch_Transmit_Handler::transmit (void)
}
void
-ACE_POSIX_AIOCB_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
+ACE_POSIX_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
// Update bytes transferred so far.
this->bytes_transferred_ += result.bytes_transferred ();
@@ -2281,7 +2388,7 @@ ACE_POSIX_AIOCB_Asynch_Transmit_Handler::handle_write_stream (const ACE_Asynch_W
}
void
-ACE_POSIX_AIOCB_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File::Result &result)
+ACE_POSIX_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read_File::Result &result)
{
// Failure.
if (result.success () == 0)
@@ -2323,7 +2430,7 @@ ACE_POSIX_AIOCB_Asynch_Transmit_Handler::handle_read_file (const ACE_Asynch_Read
}
int
-ACE_POSIX_AIOCB_Asynch_Transmit_Handler::initiate_read_file (void)
+ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file (void)
{
// Is there something to read.
if (this->file_offset_ >= this->file_size_)
@@ -2364,15 +2471,15 @@ ACE_POSIX_AIOCB_Asynch_Transmit_Handler::initiate_read_file (void)
// *********************************************************************
-ACE_POSIX_AIOCB_Asynch_Transmit_File::ACE_POSIX_AIOCB_Asynch_Transmit_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Transmit_File::ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Transmit_File_Impl (),
- ACE_POSIX_AIOCB_Asynch_Operation (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Operation (posix_aiocb_proactor)
{
}
int
-ACE_POSIX_AIOCB_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
+ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
u_long bytes_to_write,
u_long offset,
@@ -2389,7 +2496,7 @@ ACE_POSIX_AIOCB_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
if (file_size == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"Error:%N:%l:%p\n",
- "POSIX_AIOCB_Asynch_Transmit_File:filesize failed"),
+ "POSIX_Asynch_Transmit_File:filesize failed"),
-1);
if (bytes_to_write == 0)
@@ -2427,10 +2534,10 @@ ACE_POSIX_AIOCB_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
-1);
// Make the auxillary handler and initiate transmit.
- ACE_POSIX_AIOCB_Asynch_Transmit_Handler *transmit_handler = 0;
+ ACE_POSIX_Asynch_Transmit_Handler *transmit_handler = 0;
ACE_NEW_RETURN (transmit_handler,
- ::ACE_POSIX_AIOCB_Asynch_Transmit_Handler (this->posix_proactor (),
+ ::ACE_POSIX_Asynch_Transmit_Handler (this->posix_proactor (),
result),
-1);
@@ -2443,17 +2550,16 @@ ACE_POSIX_AIOCB_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
return 0;
}
-ACE_POSIX_AIOCB_Asynch_Transmit_File::~ACE_POSIX_AIOCB_Asynch_Transmit_File (void)
+ACE_POSIX_Asynch_Transmit_File::~ACE_POSIX_Asynch_Transmit_File (void)
{
}
-
// Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominance warnings. They route the
// call to the ACE_POSIX_Asynch_Operation base class.
int
-ACE_POSIX_AIOCB_Asynch_Transmit_File::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Transmit_File::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
@@ -2465,13 +2571,13 @@ ACE_POSIX_AIOCB_Asynch_Transmit_File::open (ACE_Handler &handler,
}
int
-ACE_POSIX_AIOCB_Asynch_Transmit_File::cancel (void)
+ACE_POSIX_Asynch_Transmit_File::cancel (void)
{
return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Transmit_File::proactor (void) const
+ACE_POSIX_Asynch_Transmit_File::proactor (void) const
{
return ACE_POSIX_Asynch_Operation::proactor ();
}
@@ -2790,12 +2896,12 @@ ACE_POSIX_Asynch_Write_Dgram_Result::~ACE_POSIX_Asynch_Write_Dgram_Result (void)
}
/***************************************************************************/
-ACE_POSIX_AIOCB_Asynch_Read_Dgram::~ACE_POSIX_AIOCB_Asynch_Read_Dgram (void)
+ACE_POSIX_Asynch_Read_Dgram::~ACE_POSIX_Asynch_Read_Dgram (void)
{
}
ssize_t
-ACE_POSIX_AIOCB_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
+ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
size_t &number_of_bytes_recvd,
int flags,
int protocol_family,
@@ -2814,43 +2920,43 @@ ACE_POSIX_AIOCB_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block,
}
int
-ACE_POSIX_AIOCB_Asynch_Read_Dgram::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Read_Dgram::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
{
- return ACE_POSIX_AIOCB_Asynch_Operation::open (handler,
+ return ACE_POSIX_Asynch_Operation::open (handler,
handle,
completion_key,
proactor);
}
int
-ACE_POSIX_AIOCB_Asynch_Read_Dgram::cancel (void)
+ACE_POSIX_Asynch_Read_Dgram::cancel (void)
{
- return ACE_POSIX_AIOCB_Asynch_Operation::cancel ();
+ return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Read_Dgram::proactor (void) const
+ACE_POSIX_Asynch_Read_Dgram::proactor (void) const
{
- return ACE_POSIX_AIOCB_Asynch_Operation::proactor ();
+ return ACE_POSIX_Asynch_Operation::proactor ();
}
-ACE_POSIX_AIOCB_Asynch_Read_Dgram::ACE_POSIX_AIOCB_Asynch_Read_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Read_Dgram::ACE_POSIX_Asynch_Read_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Dgram_Impl (),
- ACE_POSIX_AIOCB_Asynch_Operation (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Operation (posix_aiocb_proactor)
{
}
//***************************************************************************
-ACE_POSIX_AIOCB_Asynch_Write_Dgram::~ACE_POSIX_AIOCB_Asynch_Write_Dgram (void)
+ACE_POSIX_Asynch_Write_Dgram::~ACE_POSIX_Asynch_Write_Dgram (void)
{
}
ssize_t
-ACE_POSIX_AIOCB_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
+ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
size_t &number_of_bytes_sent,
int flags,
const ACE_Addr &addr,
@@ -2869,7 +2975,7 @@ ACE_POSIX_AIOCB_Asynch_Write_Dgram::send (ACE_Message_Block *message_block,
}
int
-ACE_POSIX_AIOCB_Asynch_Write_Dgram::open (ACE_Handler &handler,
+ACE_POSIX_Asynch_Write_Dgram::open (ACE_Handler &handler,
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor)
@@ -2881,32 +2987,46 @@ ACE_POSIX_AIOCB_Asynch_Write_Dgram::open (ACE_Handler &handler,
}
int
-ACE_POSIX_AIOCB_Asynch_Write_Dgram::cancel (void)
+ACE_POSIX_Asynch_Write_Dgram::cancel (void)
{
return ACE_POSIX_Asynch_Operation::cancel ();
}
ACE_Proactor *
-ACE_POSIX_AIOCB_Asynch_Write_Dgram::proactor (void) const
+ACE_POSIX_Asynch_Write_Dgram::proactor (void) const
{
return ACE_POSIX_Asynch_Operation::proactor ();
}
-ACE_POSIX_AIOCB_Asynch_Write_Dgram::ACE_POSIX_AIOCB_Asynch_Write_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
+ACE_POSIX_Asynch_Write_Dgram::ACE_POSIX_Asynch_Write_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Dgram_Impl (),
- ACE_POSIX_AIOCB_Asynch_Operation (posix_aiocb_proactor)
+ ACE_POSIX_Asynch_Operation (posix_aiocb_proactor)
{
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
template class ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result *>;
template class ACE_Node<ACE_POSIX_Asynch_Accept_Result *>;
template class ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Accept_Result *>;
+
+template class ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *>;
+template class ACE_Node<ACE_POSIX_Asynch_Result *>;
+template class ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Result *>;
+
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
#pragma instantiate ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result *>
#pragma instantiate ACE_Node<ACE_POSIX_Asynch_Accept_Result *>
#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Accept_Result *>
+
+#pragma instantiate ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *>
+#pragma instantiate ACE_Node<ACE_POSIX_Asynch_Result *>
+#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Result *>
+
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+
#endif /* ACE_HAS_AIO_CALLS */
diff --git a/ace/POSIX_Asynch_IO.h b/ace/POSIX_Asynch_IO.h
index 7f9693ab963..ea31b0faafb 100644
--- a/ace/POSIX_Asynch_IO.h
+++ b/ace/POSIX_Asynch_IO.h
@@ -30,6 +30,9 @@
#include "ace/Asynch_IO_Impl.h"
#include "ace/Reactor.h"
+#include "ace/Select_Reactor.h"
+#include "ace/Unbounded_Queue.h"
+#include "ace/Task.h"
// Forward declarations
class ACE_POSIX_SIG_Proactor;
@@ -140,9 +143,9 @@ protected:
/**
* @class ACE_POSIX_Asynch_Operation
*
- * @brief This class abstracts out the common things needed for
- * implementing <Asynch_Operation> for POSIX platforms. Specific
- * implementations such as <POSIX_AIOCB_Asynch_Operation>
+ * @brief This class implements <ACE_Asynch_Operation> for all
+ * implementations of Proactor (AIOCB, SIG, SUN)
+ * Specific future implementations
* can derive from this class.
*/
class ACE_Export ACE_POSIX_Asynch_Operation : public virtual ACE_Asynch_Operation_Impl
@@ -170,42 +173,15 @@ public:
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
-protected:
- /// No op contructor.
- ACE_POSIX_Asynch_Operation (void);
-
- /// Destructor.
- virtual ~ACE_POSIX_Asynch_Operation (void);
-
- /// Proactor that this Asynch IO will be registered with.
- ACE_Proactor *proactor_;
-
- /// Handler that will receive the callback.
- ACE_Handler *handler_;
-
- /// I/O handle used for reading.
- ACE_HANDLE handle_;
-};
-
-/**
- * @class ACE_POSIX_AIOCB_Asynch_Operation
- *
- * @brief This class implements <ACE_Asynch_Operation> for <AIOCB>
- * (Asynchronous I/O Control Blocks) based implementation of
- * Proactor.
- */
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Operation : public virtual ACE_POSIX_Asynch_Operation
-{
-public:
/// Return the underlying Proactor implementation.
- ACE_POSIX_AIOCB_Proactor *posix_proactor (void) const;
+ ACE_POSIX_AIOCB_Proactor * posix_proactor (void) const;
protected:
/// Contructor.
- ACE_POSIX_AIOCB_Asynch_Operation (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ ACE_POSIX_Asynch_Operation (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
/// Destructor.
- virtual ~ACE_POSIX_AIOCB_Asynch_Operation (void);
+ virtual ~ACE_POSIX_Asynch_Operation (void);
/// This is the method which does the real work to start aio
/// and should be used instead of shared_read/shared_write
@@ -228,6 +204,15 @@ protected:
* directly.
*/
ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor_;
+
+ /// Proactor that this Asynch IO will be registered with.
+ ACE_Proactor *proactor_;
+
+ /// Handler that will receive the callback.
+ ACE_Handler *handler_;
+
+ /// I/O handle used for reading.
+ ACE_HANDLE handle_;
};
/**
@@ -241,7 +226,7 @@ class ACE_Export ACE_POSIX_Asynch_Read_Stream_Result : public virtual ACE_Asynch
{
/// Factory classes willl have special permissions.
- friend class ACE_POSIX_AIOCB_Asynch_Read_Stream;
+ friend class ACE_POSIX_Asynch_Read_Stream;
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
@@ -341,18 +326,18 @@ protected:
};
/**
- * @class ACE_POSIX_AIOCB_Asynch_Read_Stream
+ * @class ACE_POSIX_Asynch_Read_Stream
*
- * This class implements <ACE_Asynch_Read_Stream> for <AIOCB>
- * (Asynchronous I/O Control Blocks) based implementation of Proactor.
+ * This class implements <ACE_Asynch_Read_Stream> for all POSIX
+ * based implementation of Proactor.
*
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Read_Stream : public virtual ACE_Asynch_Read_Stream_Impl,
- public ACE_POSIX_AIOCB_Asynch_Operation
+class ACE_Export ACE_POSIX_Asynch_Read_Stream : public virtual ACE_Asynch_Read_Stream_Impl,
+ public ACE_POSIX_Asynch_Operation
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Read_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ ACE_POSIX_Asynch_Read_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
/// This starts off an asynchronous read. Upto <bytes_to_read> will
/// be read and stored in the <message_block>.
@@ -363,7 +348,7 @@ public:
int signal_number = 0);
/// Destructor.
- virtual ~ACE_POSIX_AIOCB_Asynch_Read_Stream (void);
+ virtual ~ACE_POSIX_Asynch_Read_Stream (void);
// = Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominace warnings. They route
@@ -405,7 +390,7 @@ class ACE_Export ACE_POSIX_Asynch_Write_Stream_Result : public virtual ACE_Async
public ACE_POSIX_Asynch_Result
{
/// Factory classes will have special privilages.
- friend class ACE_POSIX_AIOCB_Asynch_Write_Stream;
+ friend class ACE_POSIX_Asynch_Write_Stream;
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
@@ -506,18 +491,17 @@ protected:
};
/**
- * @class ACE_POSIX_AIOCB_Asynch_Write_Stream
+ * @class ACE_POSIX_Asynch_Write_Stream
*
- * @brief This class implements <ACE_Asynch_Write_Stream> for <AIOCB>
- * (Asynchronous I/O Control Blocks) based implementation of
- * Proactor.
+ * @brief This class implements <ACE_Asynch_Write_Stream> for
+ * all POSIX implementations of Proactor.
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Write_Stream : public virtual ACE_Asynch_Write_Stream_Impl,
- public ACE_POSIX_AIOCB_Asynch_Operation
+class ACE_Export ACE_POSIX_Asynch_Write_Stream : public virtual ACE_Asynch_Write_Stream_Impl,
+ public ACE_POSIX_Asynch_Operation
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Write_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ ACE_POSIX_Asynch_Write_Stream (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
/// This starts off an asynchronous write. Upto <bytes_to_write>
/// will be written from the <message_block>.
@@ -528,7 +512,7 @@ public:
int signal_number = 0);
/// Destructor.
- virtual ~ACE_POSIX_AIOCB_Asynch_Write_Stream (void);
+ virtual ~ACE_POSIX_Asynch_Write_Stream (void);
// = Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominace warnings. They route
@@ -564,7 +548,7 @@ class ACE_Export ACE_POSIX_Asynch_Read_File_Result : public virtual ACE_Asynch_R
public ACE_POSIX_Asynch_Read_Stream_Result
{
/// Factory classes willl have special permissions.
- friend class ACE_POSIX_AIOCB_Asynch_Read_File;
+ friend class ACE_POSIX_Asynch_Read_File;
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
@@ -662,12 +646,11 @@ protected:
};
/**
- * @class ACE_POSIX_AIOCB_Asynch_Read_File
+ * @class ACE_POSIX_Asynch_Read_File
*
* @brief This class is a factory for starting off asynchronous reads
* on a file. This class implements <ACE_Asynch_Read_File> for
- * <AIOCB> (Asynchronous I/O Control Blocks) based implementation
- * of Proactor.
+ * all POSIX implementations of Proactor.
*
* Once <open> is called, multiple asynchronous <read>s can
* started using this class. A <ACE_Asynch_Read_File::Result>
@@ -678,13 +661,13 @@ protected:
* This class differs slightly from <ACE_Asynch_Read_Stream> as it
* allows the user to specify an offset for the read.
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Read_File : public virtual ACE_Asynch_Read_File_Impl,
- public ACE_POSIX_AIOCB_Asynch_Read_Stream
+class ACE_Export ACE_POSIX_Asynch_Read_File : public virtual ACE_Asynch_Read_File_Impl,
+ public ACE_POSIX_Asynch_Read_Stream
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Read_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ ACE_POSIX_Asynch_Read_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
/**
* This starts off an asynchronous read. Upto <bytes_to_read> will
@@ -700,7 +683,7 @@ public:
int signal_number = 0);
/// Destructor.
- virtual ~ACE_POSIX_AIOCB_Asynch_Read_File (void);
+ virtual ~ACE_POSIX_Asynch_Read_File (void);
// = Methods belong to ACE_POSIX_Asynch_Operation base class. These
@@ -727,9 +710,9 @@ public:
private:
/**
- * This belongs to ACE_POSIX_AIOCB_Asynch_Read_Stream. We have
+ * This belongs to ACE_POSIX_Asynch_Read_Stream. We have
* defined this here to avoid compiler warnings and forward the
- * method to <ACE_POSIX_AIOCB_Asynch_Read_Stream::read>.
+ * method to <ACE_POSIX_Asynch_Read_Stream::read>.
*/
int read (ACE_Message_Block &message_block,
u_long bytes_to_read,
@@ -760,7 +743,7 @@ class ACE_Export ACE_POSIX_Asynch_Write_File_Result : public virtual ACE_Asynch_
public ACE_POSIX_Asynch_Write_Stream_Result
{
/// Factory classes will have special permissions.
- friend class ACE_POSIX_AIOCB_Asynch_Write_File;
+ friend class ACE_POSIX_Asynch_Write_File;
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
@@ -857,7 +840,7 @@ protected:
};
/**
- * @class ACE_POSIX_AIOCB_Asynch_Write_File
+ * @class ACE_POSIX_Asynch_Write_File
*
* This class provides concrete implementation for
* <ACE_Asynch_Write_File> for POSIX platforms where the
@@ -865,12 +848,12 @@ protected:
* Control Blocks).
*
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Write_File : public virtual ACE_Asynch_Write_File_Impl,
- public ACE_POSIX_AIOCB_Asynch_Write_Stream
+class ACE_Export ACE_POSIX_Asynch_Write_File : public virtual ACE_Asynch_Write_File_Impl,
+ public ACE_POSIX_Asynch_Write_Stream
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Write_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ ACE_POSIX_Asynch_Write_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
/**
* This starts off an asynchronous write. Upto <bytes_to_write>
@@ -886,7 +869,7 @@ public:
int signal_number = 0);
/// Destructor.
- virtual ~ACE_POSIX_AIOCB_Asynch_Write_File (void);
+ virtual ~ACE_POSIX_Asynch_Write_File (void);
// = Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominace warnings. They route
@@ -912,9 +895,9 @@ public:
private:
/**
- * This <write> belongs to ACE_POSIX_AIOCB_Asynch_Write_Stream. We
+ * This <write> belongs to ACE_POSIX_Asynch_Write_Stream. We
* have put this here to avoid compiler warnings. We forward this
- * method call to the <ACE_POSIX_AIOCB_Asynch_Write_Stream::write>
+ * method call to the <ACE_POSIX_Asynch_Write_Stream::write>
* one.
*/
int write (ACE_Message_Block &message_block,
@@ -1046,13 +1029,6 @@ protected:
// I/O handle for the new connection.
};
-/**
- * @class ACE_POSIX_Asynch_Accept_Handler
- *
- * Forward declaration. This class is defined the in the cpp file,
- * since this is internal to the implementation.
- */
-class ACE_POSIX_Asynch_Accept_Handler;
/**
* @class ACE_POSIX_Asynch_Accept
@@ -1060,14 +1036,25 @@ class ACE_POSIX_Asynch_Accept_Handler;
*/
class ACE_Export ACE_POSIX_Asynch_Accept :
public virtual ACE_Asynch_Accept_Impl,
- public ACE_POSIX_Asynch_Operation
+ public ACE_POSIX_Asynch_Operation,
+ public ACE_Event_Handler
{
public:
+ // = TITLE
+ // For the POSIX implementation this class is common
+ // for all Proactors (AIOCB/SIG/SUN)
+ //
+ // = DESCRIPTION
+
+
/// Constructor.
- ACE_POSIX_Asynch_Accept (ACE_POSIX_Proactor * posix_proactor);
+ ACE_POSIX_Asynch_Accept (ACE_POSIX_AIOCB_Proactor * posix_aiocb_proactor);
- /**
- * This <open> belongs to ACE_AIOCB_Asynch_Operation. We forward
+ /// Destructor.
+ virtual ~ACE_POSIX_Asynch_Accept (void);
+
+ /**
+ * This <open> belongs to ACE_POSIX_Asynch_Operation. We forward
* this call to that method. We have put this here to avoid the
* compiler warnings.
*/
@@ -1094,13 +1081,7 @@ public:
int priority,
int signal_number = 0);
- /// Destructor.
- virtual ~ACE_POSIX_Asynch_Accept (void);
-
- // = Methods belong to ACE_POSIX_Asynch_Operation base class. These
- // methods are defined here to avoid dominace warnings. They route
- // the call to the ACE_POSIX_Asynch_Operation base class.
-
+
/**
* Cancel all pending pseudo-asynchronus requests
* Behavior as usual AIO request
@@ -1109,35 +1090,103 @@ public:
/**
* Close performs cancellation of all pending requests
- * Parameter flg_notify can be
- * 0 - don't send notifications about canceled accepts
- * 1 - notify user about canceled accepts
- * according POSIX standards we should receive notifications
- * on canceled AIO requests
+ * and closure the listen handle
*/
- int close ( int flg_notify);
+ int close (void);
+ /// virtual from ACE_Event_Hanlder
+ ACE_HANDLE get_handle (void) const;
+ /// virtual from ACE_Event_Hanlder
+ void set_handle (ACE_HANDLE handle);
+
+ /// virtual from ACE_Event_Hanlder
+ /// Called when accept event comes up on <listen_hanlde>
+ int handle_input (ACE_HANDLE handle);
+
+ /// virtual from ACE_Event_Hanlder
+ int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) ;
+
+ // = Methods belong to ACE_POSIX_Asynch_Operation base class. These
+ // methods are defined here to avoid dominace warnings. They route
+ // the call to the ACE_POSIX_Asynch_Operation base class.
/// Return the underlying proactor.
ACE_Proactor* proactor (void) const;
+
private:
- /// The thread function that does handle events.
- static void* thread_function (void* reactor);
+ int cancel_uncompleted (int flg_notify);
+ // flg_notify points whether or not we should send notification about
+ // canceled accepts
+ // Parameter flg_notify can be
+ // 0 - don't send notifications about canceled accepts
+ // 1 - notify user about canceled accepts
+ // according POSIX standards we should receive notifications
+ // on canceled AIO requests
+
+ int flg_open_ ;
+ /// 1 - Accept is registered in ACE_POSIX_Asynch_Accept_Task
+ /// 0 - Aceept is deregisted in ACE_POSIX_Asynch_Accept_Task
+
+
+ /// to prevent ACE_POSIX_Asynch_Accept_Task from deletion
+ /// while we make a call to the ACE_POSIX_Asynch_Accept_Task
+ /// This is extra cost !!!
+ /// we could avoid them if all applications will follow the rule:
+ /// Proactor should be deleted only after deletion all
+ /// AsynchOperation objects connected with it
+ int task_lock_count_;
+
+ ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result*> result_queue_;
+ // Queue of Result pointers that correspond to all the <accept>'s
+ // pending.
+
+ ACE_SYNCH_MUTEX lock_;
+ // The lock to protect the result queue which is shared. The queue
+ // is updated by main thread in the register function call and
+ // through the auxillary thread in the deregister fun. So let us
+ // mutex it.
+};
- /// Reactor to wait on the <listen_handle>.
- ACE_Reactor reactor_;
+/**
+ * @class ACE_POSIX_Asynch_Accept_Task
+ *
+ */
+class ACE_Export ACE_POSIX_Asynch_Accept_Task : public ACE_Task<ACE_MT_SYNCH>
+{
+ friend class ACE_POSIX_Asynch_Accept;
+public:
- /// The Event Handler to do handle_input.
- ACE_POSIX_Asynch_Accept_Handler* accept_handler_;
+ ACE_POSIX_Asynch_Accept_Task (void);
+ virtual ~ACE_POSIX_Asynch_Accept_Task (void);
- /// group id for the thread that we create for accepts
- int grp_id_ ;
+ int start (void);
+ int stop (void);
- /// POSIX Proactor implementation
- ACE_POSIX_Proactor * posix_proactor_;
-};
+ virtual int svc (void);
+
+ int register_acceptor (ACE_POSIX_Asynch_Accept *posix_accept,
+ ACE_Reactor_Mask mask);
+ int remove_acceptor (ACE_POSIX_Asynch_Accept *posix_accept);
+ int resume_acceptor (ACE_POSIX_Asynch_Accept *posix_accept);
+ int suspend_acceptor (ACE_POSIX_Asynch_Accept *posix_accept);
+
+protected:
+ int lock_finish (void);
+ int unlock_finish (void);
+
+ int flg_active_ ;
+
+ ACE_Select_Reactor select_reactor_;
+ // should be initialized before reactor_
+
+ ACE_Reactor reactor_;
+ ACE_Lock &token_;
+
+ int finish_count_;
+ ACE_Manual_Event finish_event_;
+};
/**
* @class ACE_POSIX_Asynch_Transmit_File_Result
@@ -1153,12 +1202,11 @@ class ACE_Export ACE_POSIX_Asynch_Transmit_File_Result : public virtual ACE_Asyn
public ACE_POSIX_Asynch_Result
{
/// Factory classes willl have special permissions.
- friend class ACE_POSIX_AIOCB_Asynch_Transmit_File;
+ friend class ACE_POSIX_Asynch_Transmit_File;
/// Handlers do all the job.
friend class ACE_POSIX_Asynch_Transmit_Handler;
- friend class ACE_POSIX_AIOCB_Asynch_Transmit_Handler;
-
+
/// The Proactor constructs the Result class for faking results.
friend class ACE_POSIX_Proactor;
@@ -1282,17 +1330,17 @@ protected:
};
/**
- * @class ACE_POSIX_AIOCB_Asynch_Transmit_File
+ * @class ACE_POSIX_Asynch_Transmit_File
*
* @brief Implementation for transmit_file will make use of
- * POSIX_AIOCB_Asynch_Transmit_Handler.
+ * POSIX_Asynch_Transmit_Handler.
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Transmit_File : public virtual ACE_Asynch_Transmit_File_Impl,
- public ACE_POSIX_AIOCB_Asynch_Operation
+class ACE_Export ACE_POSIX_Asynch_Transmit_File : public virtual ACE_Asynch_Transmit_File_Impl,
+ public ACE_POSIX_Asynch_Operation
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Transmit_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
/**
* This starts off an asynchronous transmit file. The <file> is a
@@ -1317,7 +1365,7 @@ public:
int signal_number = 0);
/// Destructor.
- virtual ~ACE_POSIX_AIOCB_Asynch_Transmit_File (void);
+ virtual ~ACE_POSIX_Asynch_Transmit_File (void);
// = Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid dominace warnings. They route
@@ -1344,7 +1392,7 @@ public:
/**
- * @class ACE_POSIX_AIOCB_Asynch_Read_Dgram
+ * @class ACE_POSIX_Asynch_Read_Dgram
*
* @brief This class is a factory for starting off asynchronous reads
* on a UDP socket.
@@ -1356,13 +1404,13 @@ public:
* callback.
*
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Read_Dgram : public virtual ACE_Asynch_Read_Dgram_Impl,
- public ACE_POSIX_AIOCB_Asynch_Operation
+class ACE_Export ACE_POSIX_Asynch_Read_Dgram : public virtual ACE_Asynch_Read_Dgram_Impl,
+ public ACE_POSIX_Asynch_Operation
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Read_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
- virtual ~ACE_POSIX_AIOCB_Asynch_Read_Dgram (void);
+ ACE_POSIX_Asynch_Read_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ virtual ~ACE_POSIX_Asynch_Read_Dgram (void);
/** This starts off an asynchronous read. Upto
* <message_block->total_size()> will be read and stored in the
@@ -1388,9 +1436,9 @@ public:
int priority,
int signal_number);
- // Methods belong to ACE_POSIX_AIOCB_Asynch_Operation base class. These
+ // Methods belong to ACE_POSIX_Asynch_Operation base class. These
// methods are defined here to avoid VC++ warnings. They route the
- // call to the ACE_POSIX_AIOCB_Asynch_Operation base class.
+ // call to the ACE_POSIX_Asynch_Operation base class.
/**
* Initializes the factory with information which will be used with
@@ -1415,7 +1463,7 @@ public:
protected:
/// Do-nothing constructor.
- ACE_POSIX_AIOCB_Asynch_Read_Dgram (void);
+ ACE_POSIX_Asynch_Read_Dgram (void);
};
/**
@@ -1428,7 +1476,7 @@ class ACE_Export ACE_POSIX_Asynch_Write_Dgram_Result : public virtual ACE_Asynch
public ACE_POSIX_Asynch_Result
{
/// Factory classes willl have special permissions.
- friend class ACE_POSIX_AIOCB_Asynch_Write_Dgram;
+ friend class ACE_POSIX_Asynch_Write_Dgram;
/// Proactor class has special permission.
friend class ACE_POSIX_Proactor;
@@ -1526,7 +1574,7 @@ protected:
};
/**
- * @class ACE_POSIX_AIOCB_Asynch_Write_Dgram
+ * @class ACE_POSIX_Asynch_Write_Dgram
*
* @brief This class is a factory for starting off asynchronous writes
* on a UDP socket.
@@ -1538,13 +1586,13 @@ protected:
* write completes through the
* <ACE_Handler::handle_write_stream> callback.
*/
-class ACE_Export ACE_POSIX_AIOCB_Asynch_Write_Dgram : public virtual ACE_Asynch_Write_Dgram_Impl,
- public ACE_POSIX_AIOCB_Asynch_Operation
+class ACE_Export ACE_POSIX_Asynch_Write_Dgram : public virtual ACE_Asynch_Write_Dgram_Impl,
+ public ACE_POSIX_Asynch_Operation
{
public:
/// Constructor.
- ACE_POSIX_AIOCB_Asynch_Write_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
- virtual ~ACE_POSIX_AIOCB_Asynch_Write_Dgram (void);
+ ACE_POSIX_Asynch_Write_Dgram (ACE_POSIX_AIOCB_Proactor *posix_aiocb_proactor);
+ virtual ~ACE_POSIX_Asynch_Write_Dgram (void);
/** This starts off an asynchronous send. Upto
* <message_block->total_length()> will be sent. <message_block>'s
@@ -1570,10 +1618,10 @@ public:
int priority,
int signal_number);
- // = Methods belonging to <ACE_POSIX_AIOCB_Asynch_Operation> base class.
+ // = Methods belonging to <ACE_POSIX_Asynch_Operation> base class.
// These methods are defined here to avoid VC++ warnings. They route
- // the call to the <ACE_POSIX_AIOCB_Asynch_Operation> base class.
+ // the call to the <ACE_POSIX_Asynch_Operation> base class.
/**
* Initializes the factory with information which will be used with
@@ -1598,7 +1646,7 @@ public:
protected:
/// Do-nothing constructor.
- ACE_POSIX_AIOCB_Asynch_Write_Dgram (void);
+ ACE_POSIX_Asynch_Write_Dgram (void);
};
@@ -1615,7 +1663,7 @@ class ACE_Export ACE_POSIX_Asynch_Read_Dgram_Result : public virtual ACE_Asynch_
{
/// Factory classes will have special permissions.
- friend class ACE_POSIX_AIOCB_Asynch_Read_Dgram;
+ friend class ACE_POSIX_Asynch_Read_Dgram;
/// Proactor class has special permission.
friend class ACE_POSIX_Proactor;
@@ -1631,7 +1679,7 @@ public:
/// The address of where the packet came from
int remote_address (ACE_Addr& addr) const;
- sockaddr *saddr () const;
+ sockaddr *saddr (void) const;
/// The flags used in the read
int flags (void) const;
diff --git a/ace/POSIX_Proactor.cpp b/ace/POSIX_Proactor.cpp
index 8edad89edf9..3004e21e10b 100644
--- a/ace/POSIX_Proactor.cpp
+++ b/ace/POSIX_Proactor.cpp
@@ -17,6 +17,7 @@
# include <sys/systeminfo.h>
# endif /* ACE_HAS_SYS_INFO */
+// *********************************************************************
class ACE_Export ACE_POSIX_Wakeup_Completion : public ACE_POSIX_Asynch_Result
{
// = TITLE
@@ -66,6 +67,10 @@ ACE_POSIX_Proactor::ACE_POSIX_Proactor (void)
#elif defined(HPUX)
os_id_ = OS_HPUX; // set family
+
+#elif defined(__sgi)
+
+ os_id_ = OS_IRIX; // set family
// do the same
//#else defined (LINUX, __FreeBSD__ ...)
@@ -491,7 +496,7 @@ private:
// Pipe for the communication between Proactor and the
// Asynch_Accept.
- ACE_POSIX_AIOCB_Asynch_Read_Stream read_stream_;
+ ACE_POSIX_Asynch_Read_Stream read_stream_;
// To do asynch_read on the pipe.
ACE_AIOCB_Notify_Pipe_Manager (void);
@@ -612,6 +617,10 @@ ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations)
}
create_notify_manager ();
+
+ // start pseudo-asynchronous accept task
+ // one per all future acceptors
+ this->accept_task_.start ();
}
// Special protected constructor for ACE_SUN_Proactor
@@ -643,6 +652,7 @@ ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations,
result_list_[ai] = 0;
}
+
// @@ We should create Notify_Pipe_Manager in the derived class to
// provide correct calls for virtual functions !!!
}
@@ -650,6 +660,9 @@ ACE_POSIX_AIOCB_Proactor::ACE_POSIX_AIOCB_Proactor (size_t max_aio_operations,
// Destructor.
ACE_POSIX_AIOCB_Proactor::~ACE_POSIX_AIOCB_Proactor (void)
{
+ // stop asynch accept task
+ this->get_asynch_accept_task().stop ();
+
delete_notify_manager ();
// delete all uncomlpeted operarion
@@ -863,7 +876,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_read_stream (void)
{
ACE_Asynch_Read_Stream_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Read_Stream (this),
+ ACE_POSIX_Asynch_Read_Stream (this),
0);
return implementation;
}
@@ -873,7 +886,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_write_stream (void)
{
ACE_Asynch_Write_Stream_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Write_Stream (this),
+ ACE_POSIX_Asynch_Write_Stream (this),
0);
return implementation;
}
@@ -883,7 +896,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_read_dgram (void)
{
ACE_Asynch_Read_Dgram_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Read_Dgram (this),
+ ACE_POSIX_Asynch_Read_Dgram (this),
0);
return implementation;
}
@@ -893,7 +906,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_write_dgram (void)
{
ACE_Asynch_Write_Dgram_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Write_Dgram (this),
+ ACE_POSIX_Asynch_Write_Dgram (this),
0);
return implementation;
@@ -904,7 +917,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_read_file (void)
{
ACE_Asynch_Read_File_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Read_File (this),
+ ACE_POSIX_Asynch_Read_File (this),
0);
return implementation;
}
@@ -914,7 +927,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_write_file (void)
{
ACE_Asynch_Write_File_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Write_File (this),
+ ACE_POSIX_Asynch_Write_File (this),
0);
return implementation;
}
@@ -936,7 +949,7 @@ ACE_POSIX_AIOCB_Proactor::create_asynch_transmit_file (void)
{
ACE_Asynch_Transmit_File_Impl *implementation = 0;
ACE_NEW_RETURN (implementation,
- ACE_POSIX_AIOCB_Asynch_Transmit_File (this),
+ ACE_POSIX_Asynch_Transmit_File (this),
0);
return implementation;
}
@@ -1469,6 +1482,10 @@ ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (size_t max_aio_operations)
this->setup_signal_handler (ACE_SIGRTMIN);
// we do not have to create notify manager
+ // but we should start pseudo-asynchronous accept task
+ // one per all future acceptors
+
+ this->accept_task_.start ();
return;
}
@@ -1512,11 +1529,18 @@ ACE_POSIX_SIG_Proactor::ACE_POSIX_SIG_Proactor (const sigset_t signal_set,
this->mask_signals (&this->RT_completion_signals_);
// we do not have to create notify manager
+ // but we should start pseudo-asynchronous accept task
+ // one per all future acceptors
+
+ this->accept_task_.start ();
return;
}
ACE_POSIX_SIG_Proactor::~ACE_POSIX_SIG_Proactor (void)
{
+ // stop asynch accept task
+ this->get_asynch_accept_task().stop ();
+
// @@ Enable the masked signals again.
}
@@ -1918,18 +1942,5 @@ ACE_POSIX_Wakeup_Completion::complete (u_long /* bytes_transferred */,
this->handler_.handle_wakeup ();
}
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-template class ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *>;
-template class ACE_Node<ACE_POSIX_Asynch_Result *>;
-template class ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Result *>;
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *>
-#pragma instantiate ACE_Node<ACE_POSIX_Asynch_Result *>
-#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Result *>
-
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
#endif /* ACE_HAS_AIO_CALLS */
diff --git a/ace/POSIX_Proactor.h b/ace/POSIX_Proactor.h
index 939157e5d2d..9fc6ec6cc8c 100644
--- a/ace/POSIX_Proactor.h
+++ b/ace/POSIX_Proactor.h
@@ -26,7 +26,6 @@
#include "ace/Free_List.h"
#include "ace/Pipe.h"
#include "ace/POSIX_Asynch_IO.h"
-#include "ace/Unbounded_Queue.h"
#define ACE_AIO_MAX_SIZE 2048
#define ACE_AIO_DEFAULT_SIZE 1024
@@ -77,7 +76,8 @@ public:
OS_HPUX = 0x0400, // HPUX family
OS_HPUX_11 = OS_HPUX | 0x0001,
OS_LINUX = 0x0800, // Linux family
- OS_FREEBSD = 0x1000 // FreeBSD family
+ OS_FREEBSD = 0x1000, // FreeBSD family
+ OS_IRIX = 0x2000 // SGI IRIX family
};
virtual Proactor_Type get_impl_type (void);
@@ -244,6 +244,7 @@ protected:
// Forward declarations.
class ACE_AIOCB_Notify_Pipe_Manager;
+class ACE_POSIX_Accept_Task;
/**
* @class ACE_POSIX_AIOCB_Proactor
@@ -260,12 +261,10 @@ class ACE_Export ACE_POSIX_AIOCB_Proactor : public ACE_POSIX_Proactor
/// This class does the registering of Asynch Operations with the
/// Proactor which is necessary in the AIOCB strategy.
- friend class ACE_POSIX_AIOCB_Asynch_Operation;
-
- // friend class ACE_POSIX_AIOCB_Asynch_Accept_Handler; For
- // <Asynch_Accept> operation class, this helper class takes care of
- // doing the <Asynch_Accept>.
+ friend class ACE_POSIX_Asynch_Operation;
+ friend class ACE_POSIX_Asynch_Accept;
+
public:
/// Constructor defines max number asynchronous operations
/// which can be started at the same time
@@ -335,6 +334,9 @@ protected:
ACE_POSIX_AIOCB_Proactor (size_t nmaxop,
ACE_POSIX_Proactor::Proactor_Type ptype);
+ /// Task to process pseudo-asynchronous accept
+ ACE_POSIX_Asynch_Accept_Task &get_asynch_accept_task (void);
+
/// Call these methods from derived class when virtual table is
/// built.
void create_notify_manager (void);
@@ -369,10 +371,10 @@ protected:
virtual int start_aio (ACE_POSIX_Asynch_Result *result);
/// Start deferred AIO if necessary
- int start_deferred_aio();
+ int start_deferred_aio (void);
/// Cancel running or deferred AIO
- virtual int cancel_aiocb ( ACE_POSIX_Asynch_Result * result );
+ virtual int cancel_aiocb (ACE_POSIX_Asynch_Result * result);
/// Extract the results of aio.
ACE_POSIX_Asynch_Result *find_completed_aio (int &error_status,
@@ -386,7 +388,7 @@ protected:
/// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
/// called from post_completion method
- virtual int notify_completion ( int sig_num );
+ virtual int notify_completion (int sig_num);
/// Put "post_completed" result into the internal queue
int putq_result (ACE_POSIX_Asynch_Result *result);
@@ -433,6 +435,9 @@ protected:
/// Queue which keeps "post_completed" ACE_POSIX_Asynch_Result's
ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *> result_queue_;
+
+ /// Task to process pseudo-asynchronous accept
+ ACE_POSIX_Asynch_Accept_Task accept_task_;
};
/**
@@ -538,7 +543,7 @@ protected:
/// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
/// called from post_completion method
- virtual int notify_completion ( int sig_num );
+ virtual int notify_completion (int sig_num);
sigset_t RT_completion_signals_;
};
@@ -553,7 +558,6 @@ protected:
*/
class ACE_Export ACE_POSIX_Asynch_Timer : public ACE_POSIX_Asynch_Result
{
-
/// The factory method for this class is with the POSIX_Proactor
/// class.
friend class ACE_POSIX_Proactor;
diff --git a/ace/POSIX_Proactor.i b/ace/POSIX_Proactor.i
index e9935da90c9..21ec0a46656 100644
--- a/ace/POSIX_Proactor.i
+++ b/ace/POSIX_Proactor.i
@@ -18,3 +18,9 @@ ACE_POSIX_Proactor::Proactor_Type ACE_POSIX_SIG_Proactor::get_impl_type (void)
{
return PROACTOR_SIG;
}
+
+ACE_INLINE
+ACE_POSIX_Asynch_Accept_Task& ACE_POSIX_AIOCB_Proactor::get_asynch_accept_task (void)
+{
+ return this->accept_task_;
+}
diff --git a/ace/SUN_Proactor.cpp b/ace/SUN_Proactor.cpp
index b81eddd63b9..f406393c747 100644
--- a/ace/SUN_Proactor.cpp
+++ b/ace/SUN_Proactor.cpp
@@ -20,11 +20,19 @@ ACE_SUN_Proactor::ACE_SUN_Proactor (size_t max_aio_operations)
{
// To provide correct virtual calls.
create_notify_manager ();
+
+ // we should start pseudo-asynchronous accept task
+ // one per all future acceptors
+
+ this->accept_task_.start ();
}
// Destructor.
ACE_SUN_Proactor::~ACE_SUN_Proactor (void)
{
+ // stop asynch accept task
+ this->get_asynch_accept_task().stop ();
+
// to provide correct virtual calls
delete_notify_manager ();
}
diff --git a/ace/TTY_IO.cpp b/ace/TTY_IO.cpp
index e04d631dab3..e215ca62c34 100644
--- a/ace/TTY_IO.cpp
+++ b/ace/TTY_IO.cpp
@@ -4,6 +4,11 @@
ACE_RCSID(ace, TTY_IO, "$Id$")
+ACE_TTY_IO::Serial_Params::Serial_Params (void)
+{
+ ACE_OS::memset (this, 0, sizeof *this);
+}
+
// Interface for reading/writing serial device parameters
int
diff --git a/ace/TTY_IO.h b/ace/TTY_IO.h
index 0f0bdc1b2fb..7822885e2f7 100644
--- a/ace/TTY_IO.h
+++ b/ace/TTY_IO.h
@@ -48,6 +48,8 @@ public:
struct Serial_Params
{
+ Serial_Params (void);
+
// Common params
int baudrate;
int parityenb;