summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-26 00:48:54 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-26 00:48:54 +0000
commit872cec930ccc788b1f2cf5c1fb7c327c0729e356 (patch)
tree07c8c1ffd82cdaf537786128b17266b743baa57d /ace
parent568d39a7e2f18cf32b1946795f4425220dd4f6c8 (diff)
downloadATCD-872cec930ccc788b1f2cf5c1fb7c327c0729e356.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/Proactor.cpp1
-rw-r--r--ace/Select_Reactor_Base.cpp21
-rw-r--r--ace/Service_Config.cpp14
-rw-r--r--ace/WFMO_Reactor.cpp310
-rw-r--r--ace/WFMO_Reactor.h70
-rw-r--r--ace/WFMO_Reactor.i152
6 files changed, 348 insertions, 220 deletions
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp
index a09486e11ea..0b104032304 100644
--- a/ace/Proactor.cpp
+++ b/ace/Proactor.cpp
@@ -3,6 +3,7 @@
#define ACE_BUILD_DLL
#include "ace/Proactor.h"
#include "ace/Proactor_Impl.h"
+#include "ace/Object_Manager.h"
ACE_RCSID(ace, Proactor, "$Id$")
diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp
index af3fc8f88d0..cd007b240e5 100644
--- a/ace/Select_Reactor_Base.cpp
+++ b/ace/Select_Reactor_Base.cpp
@@ -693,17 +693,21 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
ACE_FDS_PTMF ptmf = &ACE_Handle_Set::set_bit;
u_long omask = ACE_Event_Handler::NULL_MASK;
+ // Find the old reactor masks. This automatically does the work of
+ // the GET_MASK operation.
+ if (handle_set.rd_mask_.is_set (handle))
+ ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK);
+ if (handle_set.wr_mask_.is_set (handle))
+ ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK);
+ if (handle_set.ex_mask_.is_set (handle))
+ ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK);
+
switch (ops)
{
case ACE_Reactor::GET_MASK:
- if (handle_set.rd_mask_.is_set (handle))
- ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK);
- if (handle_set.wr_mask_.is_set (handle))
- ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK);
- if (handle_set.ex_mask_.is_set (handle))
- ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK);
+ // The work for this operation is done in all cases at the
+ // begining of the function.
break;
-
case ACE_Reactor::CLR_MASK:
ptmf = &ACE_Handle_Set::clr_bit;
/* FALLTHRU */
@@ -725,7 +729,6 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
|| ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK))
{
(handle_set.rd_mask_.*ptmf) (handle);
- ACE_SET_BITS (omask, ACE_Event_Handler::READ_MASK);
}
else if (ops == ACE_Reactor::SET_MASK)
handle_set.rd_mask_.clr_bit (handle);
@@ -737,7 +740,6 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
ACE_Event_Handler::CONNECT_MASK))
{
(handle_set.wr_mask_.*ptmf) (handle);
- ACE_SET_BITS (omask, ACE_Event_Handler::WRITE_MASK);
}
else if (ops == ACE_Reactor::SET_MASK)
handle_set.wr_mask_.clr_bit (handle);
@@ -751,7 +753,6 @@ ACE_Select_Reactor_Impl::bit_ops (ACE_HANDLE handle,
)
{
(handle_set.ex_mask_.*ptmf) (handle);
- ACE_SET_BITS (omask, ACE_Event_Handler::EXCEPT_MASK);
}
else if (ops == ACE_Reactor::SET_MASK)
handle_set.ex_mask_.clr_bit (handle);
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index ca9001ee6b7..92cc2a0f44c 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -710,15 +710,10 @@ ACE_Service_Config::close (void)
{
ACE_TRACE ("ACE_Service_Config::close");
- // ACE_Service_Config must be deleted before the Singletons are
- // closed so that an object's fini() method may reference a valid
- // ACE_Reactor.
+ // Delete the service repository. All the objects inside the service
+ // repository have already been finalized .
ACE_Service_Config::close_svcs ();
- // The Singletons can be used independently of the services.
- // Therefore, this call must go out here.
- ACE_Service_Config::close_singletons ();
-
// Delete the list fo svc.conf files
delete ACE_Service_Config::svc_conf_file_queue_;
ACE_Service_Config::svc_conf_file_queue_ = 0;
@@ -751,6 +746,11 @@ ACE_Service_Config::fini_svcs (void)
int result = ACE_Service_Repository::instance ()->fini ();
+ // Since the fini() method of the objects inside the service
+ // repository may reference the ACE singletons, they must be
+ // destroyed after the objects have been finalized.
+ ACE_Service_Config::close_singletons ();
+
if (ACE::debug ())
ACE_Log_Msg::enable_debug_messages ();
diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp
index cd689927ec5..d1c7043b35c 100644
--- a/ace/WFMO_Reactor.cpp
+++ b/ace/WFMO_Reactor.cpp
@@ -27,8 +27,8 @@ int
ACE_WFMO_Reactor_Handler_Repository::open (size_t size)
{
if (size > MAXIMUM_WAIT_OBJECTS)
- ACE_ERROR_RETURN ((LM_ERROR,
- ASYS_TEXT ("%d exceeds MAXIMUM_WAIT_OBJECTS (%d)\n"),
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("%d exceeds MAXIMUM_WAIT_OBJECTS (%d)\n"),
size,
MAXIMUM_WAIT_OBJECTS),
-1);
@@ -71,40 +71,131 @@ ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void)
delete [] this->to_be_added_info_;
}
-void
-ACE_WFMO_Reactor_Handler_Repository::remove_network_events_i (long &existing_masks,
- ACE_Reactor_Mask to_be_removed_masks)
+ACE_Reactor_Mask
+ACE_WFMO_Reactor_Handler_Repository::bit_ops (long &existing_masks,
+ ACE_Reactor_Mask change_masks,
+ int operation)
{
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::READ_MASK))
+ //
+ // Find the old reactor masks. This automatically does the work of
+ // the GET_MASK operation.
+ //
+
+ ACE_Reactor_Mask old_masks = ACE_Event_Handler::NULL_MASK;
+
+ if (ACE_BIT_ENABLED (existing_masks, FD_READ) ||
+ ACE_BIT_ENABLED (existing_masks, FD_CLOSE))
{
- ACE_CLR_BITS (existing_masks, FD_READ);
- ACE_CLR_BITS (existing_masks, FD_CLOSE);
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::READ_MASK);
}
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::WRITE_MASK))
- ACE_CLR_BITS (existing_masks, FD_WRITE);
+ if (ACE_BIT_ENABLED (existing_masks, FD_WRITE))
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::WRITE_MASK);
+
+ if (ACE_BIT_ENABLED (existing_masks, FD_OOB))
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::EXCEPT_MASK);
+
+ if (ACE_BIT_ENABLED (existing_masks, FD_ACCEPT))
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::ACCEPT_MASK);
+
+ if (ACE_BIT_ENABLED (existing_masks, FD_CONNECT))
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::CONNECT_MASK);
+
+ if (ACE_BIT_ENABLED (existing_masks, FD_QOS))
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::QOS_MASK);
+
+ if (ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS))
+ ACE_SET_BITS (old_masks, ACE_Event_Handler::GROUP_QOS_MASK);
+
+ switch (operation)
+ {
+ case ACE_Reactor::CLR_MASK:
+
+ //
+ // For the CLR_MASK operation, clear only the specific masks.
+ //
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK))
+ {
+ ACE_CLR_BITS (existing_masks, FD_READ);
+ ACE_CLR_BITS (existing_masks, FD_CLOSE);
+ }
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK))
+ ACE_CLR_BITS (existing_masks, FD_WRITE);
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK))
+ ACE_CLR_BITS (existing_masks, FD_OOB);
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK))
+ ACE_CLR_BITS (existing_masks, FD_ACCEPT);
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK))
+ ACE_CLR_BITS (existing_masks, FD_CONNECT);
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK))
+ ACE_CLR_BITS (existing_masks, FD_QOS);
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK))
+ ACE_CLR_BITS (existing_masks, FD_GROUP_QOS);
+
+ break;
+
+ case ACE_Reactor::SET_MASK:
+
+ //
+ // If the operation is a set, first reset any existing masks
+ //
+
+ existing_masks = 0;
+ /* FALLTHRU */
+
+ case ACE_Reactor::ADD_MASK:
+
+ //
+ // For the ADD_MASK and the SET_MASK operation, add only the
+ // specific masks.
+ //
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK))
+ {
+ ACE_SET_BITS (existing_masks, FD_READ);
+ ACE_SET_BITS (existing_masks, FD_CLOSE);
+ }
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::EXCEPT_MASK))
- ACE_CLR_BITS (existing_masks, FD_OOB);
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK))
+ ACE_SET_BITS (existing_masks, FD_WRITE);
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::ACCEPT_MASK))
- ACE_CLR_BITS (existing_masks, FD_ACCEPT);
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK))
+ ACE_SET_BITS (existing_masks, FD_OOB);
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::CONNECT_MASK))
- ACE_CLR_BITS (existing_masks, FD_CONNECT);
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK))
+ ACE_SET_BITS (existing_masks, FD_ACCEPT);
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::QOS_MASK))
- ACE_CLR_BITS (existing_masks, FD_QOS);
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK))
+ ACE_SET_BITS (existing_masks, FD_CONNECT);
- if (ACE_BIT_ENABLED (to_be_removed_masks,
- ACE_Event_Handler::GROUP_QOS_MASK))
- ACE_CLR_BITS (existing_masks, FD_GROUP_QOS);
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK))
+ ACE_SET_BITS (existing_masks, FD_QOS);
+
+ if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK))
+ ACE_SET_BITS (existing_masks, FD_GROUP_QOS);
+
+ break;
+
+ case ACE_Reactor::GET_MASK:
+
+ //
+ // The work for this operation is done in all cases at the
+ // begining of the function.
+ //
+
+ ACE_UNUSED_ARG (change_masks);
+
+ break;
+ }
+
+ return old_masks;
}
int
@@ -133,7 +224,8 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
// Make sure that it is not already marked for deleted
!this->current_info_[i].delete_entry_)
{
- result = this->remove_handler_i (i, mask);
+ result = this->remove_handler_i (i,
+ mask);
if (result == -1)
error = 1;
}
@@ -147,7 +239,8 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
// Make sure that it is not already marked for deleted
!this->current_suspended_info_[i].delete_entry_)
{
- result = this->remove_suspended_handler_i (i, mask);
+ result = this->remove_suspended_handler_i (i,
+ mask);
if (result == -1)
error = 1;
}
@@ -161,7 +254,8 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle,
// Make sure that it is not already marked for deleted
!this->to_be_added_info_[i].delete_entry_)
{
- result = this->remove_to_be_added_handler_i (i, mask);
+ result = this->remove_to_be_added_handler_i (i,
+ mask);
if (result == -1)
error = 1;
}
@@ -183,8 +277,9 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t index,
{
// See if there are other events that the <Event_Handler> is
// interested in
- this->remove_network_events_i (this->current_info_[index].network_events_,
- to_be_removed_masks);
+ this->bit_ops (this->current_info_[index].network_events_,
+ to_be_removed_masks,
+ ACE_Reactor::CLR_MASK);
// Disassociate/Reassociate the event from/with the I/O handle.
// This will depend on the value of remaining set of network
@@ -216,7 +311,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t index,
// Remember the mask
this->current_info_[index].close_masks_ = to_be_removed_masks;
// Increment the handle count
- this->handles_to_be_deleted_++;
+ this->handles_to_be_deleted_++;
}
else
{
@@ -229,7 +324,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t index,
if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0)
{
ACE_HANDLE handle = this->current_info_[index].io_handle_;
- this->current_info_[index].event_handler_->handle_close (handle,
+ this->current_info_[index].event_handler_->handle_close (handle,
to_be_removed_masks);
}
}
@@ -246,8 +341,9 @@ ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t index,
{
// See if there are other events that the <Event_Handler> is
// interested in
- this->remove_network_events_i (this->current_suspended_info_[index].network_events_,
- to_be_removed_masks);
+ this->bit_ops (this->current_suspended_info_[index].network_events_,
+ to_be_removed_masks,
+ ACE_Reactor::CLR_MASK);
// Disassociate/Reassociate the event from/with the I/O handle.
// This will depend on the value of remaining set of network
@@ -309,8 +405,9 @@ ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t index,
{
// See if there are other events that the <Event_Handler> is
// interested in
- this->remove_network_events_i (this->to_be_added_info_[index].network_events_,
- to_be_removed_masks);
+ this->bit_ops (this->to_be_added_info_[index].network_events_,
+ to_be_removed_masks,
+ ACE_Reactor::CLR_MASK);
// Disassociate/Reassociate the event from/with the I/O handle.
// This will depend on the value of remaining set of network
@@ -355,7 +452,7 @@ ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t index,
if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0)
{
ACE_HANDLE handle = this->to_be_added_info_[index].io_handle_;
- this->to_be_added_info_[index].event_handler_->handle_close (handle,
+ this->to_be_added_info_[index].event_handler_->handle_close (handle,
to_be_removed_masks);
}
}
@@ -821,7 +918,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void)
return 0;
}
-void
+void
ACE_WFMO_Reactor_Handler_Repository::dump (void) const
{
size_t i = 0;
@@ -830,7 +927,7 @@ ACE_WFMO_Reactor_Handler_Repository::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Max size = %d\n"),
this->max_size_));
@@ -883,7 +980,7 @@ ACE_WFMO_Reactor_Handler_Repository::dump (void) const
ACE_DEBUG ((LM_DEBUG,
ACE_END_DUMP));
}
-
+
/************************************************************/
ACE_WFMO_Reactor::ACE_WFMO_Reactor (ACE_Sig_Handler *sh,
@@ -1032,7 +1129,7 @@ ACE_WFMO_Reactor::open (size_t size,
// Open the notification handler
if (this->notify_handler_->open (this, this->timer_queue_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_ERROR,
ASYS_TEXT ("%p\n"),
ASYS_TEXT ("opening notify handler ")),
-1);
@@ -1138,7 +1235,7 @@ int
ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
- ACE_Reactor_Mask mask)
+ ACE_Reactor_Mask new_masks)
{
// Make sure that the <handle> is valid
if (io_handle == ACE_INVALID_HANDLE)
@@ -1149,22 +1246,24 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
long new_network_events = 0;
int delete_event = 0;
-
auto_ptr <ACE_Auto_Event> event;
- // Look up the repository to see if the <Event_Handler> is already
+ // Look up the repository to see if the <event_handler> is already
// there.
- int found = this->handler_rep_.add_network_events_i (mask,
- io_handle,
- new_network_events,
- event_handle,
- delete_event);
+ ACE_Reactor_Mask old_masks;
+ int found = this->handler_rep_.modify_network_events_i (io_handle,
+ new_masks,
+ old_masks,
+ new_network_events,
+ event_handle,
+ delete_event,
+ ACE_Reactor::ADD_MASK);
// Check to see if the user passed us a valid event; If not then we
// need to create one
if (event_handle == ACE_INVALID_HANDLE)
{
- event = auto_ptr <ACE_Auto_Event> (new ACE_Auto_Event);
+ event = auto_ptr<ACE_Auto_Event> (new ACE_Auto_Event);
event_handle = event->handle ();
delete_event = 1;
}
@@ -1183,8 +1282,8 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
event_handle,
delete_event) != -1)
{
- // The <Event_Handler was not found in the repository Add to the
- // repository.
+ // The <event_handler> was not found in the repository, add to
+ // the repository.
if (delete_event)
event->handle (ACE_INVALID_HANDLE);
return 0;
@@ -1194,8 +1293,9 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
}
int
-ACE_WFMO_Reactor::schedule_wakeup_i (ACE_HANDLE io_handle,
- ACE_Reactor_Mask masks_to_be_added)
+ACE_WFMO_Reactor::mask_ops_i (ACE_HANDLE io_handle,
+ ACE_Reactor_Mask new_masks,
+ int operation)
{
// Make sure that the <handle> is valid
if (this->handler_rep_.invalid_handle (io_handle))
@@ -1207,28 +1307,40 @@ ACE_WFMO_Reactor::schedule_wakeup_i (ACE_HANDLE io_handle,
// Look up the repository to see if the <Event_Handler> is already
// there.
- int found = this->handler_rep_.add_network_events_i (masks_to_be_added,
- io_handle,
- new_network_events,
- event_handle,
- delete_event);
+ ACE_Reactor_Mask old_masks;
+ int found = this->handler_rep_.modify_network_events_i (io_handle,
+ new_masks,
+ old_masks,
+ new_network_events,
+ event_handle,
+ delete_event,
+ operation);
if (found)
- return ::WSAEventSelect ((SOCKET) io_handle,
- event_handle,
- new_network_events);
+ {
+ int result = ::WSAEventSelect ((SOCKET) io_handle,
+ event_handle,
+ new_network_events);
+ if (result == 0)
+ return old_masks;
+ else
+ return result;
+ }
else
return -1;
}
+
int
-ACE_WFMO_Reactor_Handler_Repository::add_network_events_i (ACE_Reactor_Mask mask,
- ACE_HANDLE io_handle,
- long &new_masks,
- ACE_HANDLE &event_handle,
- int &delete_event)
+ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_handle,
+ ACE_Reactor_Mask new_masks,
+ ACE_Reactor_Mask &old_masks,
+ long &new_network_events,
+ ACE_HANDLE &event_handle,
+ int &delete_event,
+ int operation)
{
- long *modified_masks = &new_masks;
+ long *modified_network_events = &new_network_events;
int found = 0;
size_t i;
@@ -1241,7 +1353,7 @@ ACE_WFMO_Reactor_Handler_Repository::add_network_events_i (ACE_Reactor_Mask mask
!this->current_info_[i].delete_entry_)
{
found = 1;
- modified_masks = &this->current_info_[i].network_events_;
+ modified_network_events = &this->current_info_[i].network_events_;
delete_event = this->current_info_[i].delete_event_;
event_handle = this->current_handles_[i];
}
@@ -1255,7 +1367,7 @@ ACE_WFMO_Reactor_Handler_Repository::add_network_events_i (ACE_Reactor_Mask mask
!this->current_suspended_info_[i].delete_entry_)
{
found = 1;
- modified_masks = &this->current_suspended_info_[i].network_events_;
+ modified_network_events = &this->current_suspended_info_[i].network_events_;
delete_event = this->current_suspended_info_[i].delete_event_;
event_handle = this->current_suspended_info_[i].event_handle_;
}
@@ -1269,36 +1381,16 @@ ACE_WFMO_Reactor_Handler_Repository::add_network_events_i (ACE_Reactor_Mask mask
!this->to_be_added_info_[i].delete_entry_)
{
found = 1;
- modified_masks = &this->to_be_added_info_[i].network_events_;
+ modified_network_events = &this->to_be_added_info_[i].network_events_;
delete_event = this->to_be_added_info_[i].delete_event_;
event_handle = this->to_be_added_info_[i].event_handle_;
}
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK))
- {
- ACE_SET_BITS (*modified_masks, FD_READ);
- ACE_SET_BITS (*modified_masks, FD_CLOSE);
- }
-
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK))
- ACE_SET_BITS (*modified_masks, FD_WRITE);
-
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK))
- ACE_SET_BITS (*modified_masks, FD_OOB);
-
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK))
- ACE_SET_BITS (*modified_masks, FD_ACCEPT);
-
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK))
- ACE_SET_BITS (*modified_masks, FD_CONNECT);
-
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::QOS_MASK))
- ACE_SET_BITS (*modified_masks, FD_QOS);
+ old_masks = this->bit_ops (*modified_network_events,
+ new_masks,
+ operation);
- if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::GROUP_QOS_MASK))
- ACE_SET_BITS (*modified_masks, FD_GROUP_QOS);
-
- new_masks = *modified_masks;
+ new_network_events = *modified_network_events;
return found;
}
@@ -1410,8 +1502,8 @@ ACE_WFMO_Reactor::poll_remaining_handles (size_t index)
{
return ::WaitForMultipleObjects (this->handler_rep_.max_handlep1 () - index,
this->handler_rep_.handles () + index,
- FALSE,
- 0);
+ FALSE,
+ 0);
}
int
@@ -1508,14 +1600,14 @@ ACE_WFMO_Reactor::dispatch_handles (size_t wait_status)
// Dispatch handler
if (this->dispatch_handler (dispatch_index, max_handlep1) == -1)
return -1;
-
+
// Increment index
dispatch_index++;
// We're done.
if (dispatch_index >= max_handlep1)
return number_of_handlers_dispatched;
-
+
// Readjust nCount
nCount = max_handlep1 - dispatch_index;
@@ -1534,7 +1626,7 @@ ACE_WFMO_Reactor::dispatch_handles (size_t wait_status)
}
int
-ACE_WFMO_Reactor::dispatch_handler (size_t index,
+ACE_WFMO_Reactor::dispatch_handler (size_t index,
size_t max_handlep1)
{
// Check if there are window messages that need to be dispatched
@@ -1557,7 +1649,7 @@ ACE_WFMO_Reactor::dispatch_handler (size_t index,
return this->complex_dispatch_handler (index, event_handle);
else
return this->simple_dispatch_handler (index, event_handle);
- }
+ }
else
// The handle was scheduled for deletion, so we will skip it.
return 0;
@@ -1623,19 +1715,19 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler,
{
long actual_events = events.lNetworkEvents;
- if ((interested_events & actual_events & FD_READ) &&
+ if ((interested_events & actual_events & FD_READ) &&
event_handler->handle_input (io_handle) == -1)
ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK);
-
+
if ((interested_events & actual_events & FD_CLOSE) &&
!ACE_BIT_ENABLED (problems, ACE_Event_Handler::READ_MASK) &&
event_handler->handle_input (io_handle) == -1)
ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK);
-
+
if ((interested_events & actual_events & FD_ACCEPT) &&
event_handler->handle_input (io_handle) == -1)
ACE_SET_BITS (problems, ACE_Event_Handler::ACCEPT_MASK);
-
+
if ((interested_events & actual_events & FD_WRITE) &&
event_handler->handle_output (io_handle) == -1)
ACE_SET_BITS (problems, ACE_Event_Handler::WRITE_MASK);
@@ -1739,11 +1831,11 @@ ACE_WFMO_Reactor::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Count of currently active threads = %d\n"),
this->active_threads_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("ID of owner thread = %d\n"),
this->owner_));
diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h
index 7bb17b85eb2..f27b2486441 100644
--- a/ace/WFMO_Reactor.h
+++ b/ace/WFMO_Reactor.h
@@ -260,10 +260,13 @@ public:
// Insert I/O <Event_Handler> entry into the system. This method
// assumes that the lock are head *before* this method is invoked.
- int unbind (ACE_HANDLE, ACE_Reactor_Mask mask);
+ int unbind (ACE_HANDLE,
+ ACE_Reactor_Mask mask);
// Remove the binding of <ACE_HANDLE> in accordance with the <mask>.
- int unbind_i (ACE_HANDLE, ACE_Reactor_Mask mask, int &changes_required);
+ int unbind_i (ACE_HANDLE,
+ ACE_Reactor_Mask mask,
+ int &changes_required);
// Non-lock-grabbing version of <unbind>
void unbind_all (void);
@@ -295,18 +298,21 @@ public:
int scheduled_for_deletion (size_t index) const;
// Check to see if <index> has been scheduled for deletion
- int add_network_events_i (ACE_Reactor_Mask mask,
- ACE_HANDLE io_handle,
- long &new_mask,
- ACE_HANDLE &event_handle,
- int &delete_event);
- // This method is used to calculate the network mask after a
- // register request to <WFMO_Reactor>. Note that because the
- // <Event_Handler> may already be in the handler repository, we may
- // have to find the old event and the old network events
-
- void remove_network_events_i (long &existing_masks,
- ACE_Reactor_Mask to_be_removed_masks);
+ int modify_network_events_i (ACE_HANDLE io_handle,
+ ACE_Reactor_Mask new_masks,
+ ACE_Reactor_Mask &old_masks,
+ long &new_network_events,
+ ACE_HANDLE &event_handle,
+ int &delete_event,
+ int operation);
+ // This method is used to calculate the network mask after a mask_op
+ // request to <WFMO_Reactor>. Note that because the <Event_Handler>
+ // may already be in the handler repository, we may have to find the
+ // old event and the old network events
+
+ ACE_Reactor_Mask bit_ops (long &existing_masks,
+ ACE_Reactor_Mask to_be_removed_masks,
+ int operation);
// This method is used to change the network mask left (if any)
// after a remove request to <WFMO_Reactor>
@@ -786,13 +792,16 @@ public:
// registered with WFMO_Reactor.
virtual int cancel_wakeup (ACE_Event_Handler *event_handler,
- ACE_Reactor_Mask mask);
- // This method is identical to the <remove_handler> method.
+ ACE_Reactor_Mask masks_to_be_deleted);
+ // Remove <masks_to_be_deleted> to the <handle>'s entry in
+ // WFMO_Reactor. The Event_Handler associated with <handle> must
+ // already have been registered with WFMO_Reactor.
virtual int cancel_wakeup (ACE_HANDLE handle,
- ACE_Reactor_Mask mask);
- // This method is identical to the <remove_handler> method.
-
+ ACE_Reactor_Mask masks_to_be_deleted);
+ // Remove <masks_to_be_deleted> to the <handle>'s entry in
+ // WFMO_Reactor. The Event_Handler associated with <handle> must
+ // already have been registered with WFMO_Reactor.
// = Notification methods.
@@ -867,14 +876,18 @@ public:
// = Low-level wait_set mask manipulation methods.
virtual int mask_ops (ACE_Event_Handler *event_handler,
- ACE_Reactor_Mask mask,
- int ops);
- // Not implemented
+ ACE_Reactor_Mask masks,
+ int operation);
+ // Modify <masks> of the <event_handler>'s entry in WFMO_Reactor
+ // depending upon <operation>. <event_handler> must already have
+ // been registered with WFMO_Reactor.
virtual int mask_ops (ACE_HANDLE handle,
- ACE_Reactor_Mask mask,
+ ACE_Reactor_Mask masks,
int ops);
- // Not implemented
+ // Modify <masks> of the <handle>'s entry in WFMO_Reactor depending
+ // upon <operation>. <handle> must already have been registered
+ // with WFMO_Reactor.
// = Low-level ready_set mask manipulation methods.
@@ -895,10 +908,6 @@ public:
// Dump the state of an object.
protected:
- virtual int schedule_wakeup_i (ACE_HANDLE handle,
- ACE_Reactor_Mask masks_to_be_added);
- // Scheduling workhorse
-
virtual int register_handler_i (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
@@ -909,6 +918,11 @@ protected:
int alertable = 0);
// Event handling workhorse
+ virtual int mask_ops_i (ACE_HANDLE io_handle,
+ ACE_Reactor_Mask masks,
+ int operation);
+ // Bit masking workhorse
+
virtual ACE_thread_t owner_i (void);
// Return the ID of the "owner" thread. Does not do any locking.
diff --git a/ace/WFMO_Reactor.i b/ace/WFMO_Reactor.i
index b6824804df7..0b204c6b736 100644
--- a/ace/WFMO_Reactor.i
+++ b/ace/WFMO_Reactor.i
@@ -71,42 +71,42 @@ ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (Common_Info &common_info)
*this = common_info;
}
-ACE_INLINE void
+ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump (void) const
{
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("I/O Entry = %d\n"),
this->io_entry_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Event Handler = %d\n"),
this->event_handler_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("I/O Handle = %d\n"),
this->io_handle_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Network Events = %d\n"),
this->network_events_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Delete Event = %d\n"),
this->delete_event_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Delete Entry = %d\n"),
this->delete_entry_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Close Masks = %d\n"),
this->close_masks_));
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
/************************************************************/
@@ -152,7 +152,7 @@ ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset (void)
Common_Info::reset ();
}
-ACE_INLINE void
+ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle) const
{
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump");
@@ -161,15 +161,15 @@ ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle
Common_Info::dump ();
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Event Handle = %d\n"),
event_handle));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Suspend Entry = %d\n"),
- this->suspend_entry_));
+ this->suspend_entry_));
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
/************************************************************/
@@ -221,7 +221,7 @@ ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset (void)
Common_Info::reset ();
}
-ACE_INLINE void
+ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump (void) const
{
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump");
@@ -230,15 +230,15 @@ ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump (void) const
Common_Info::dump ();
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Event Handle = %d\n"),
this->event_handle_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Suspend Entry = %d\n"),
- this->suspend_entry_));
+ this->suspend_entry_));
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
/************************************************************/
@@ -290,7 +290,7 @@ ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handl
Common_Info::set (common_info);
}
-ACE_INLINE void
+ACE_INLINE void
ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump (void) const
{
ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump");
@@ -299,15 +299,15 @@ ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump (void) const
Common_Info::dump ();
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Event Handle = %d\n"),
this->event_handle_));
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("Resume Entry = %d\n"),
- this->resume_entry_));
+ this->resume_entry_));
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
/************************************************************/
@@ -382,9 +382,9 @@ ACE_INLINE int
ACE_WFMO_Reactor_Handler_Repository::changes_required (void)
{
// Check if handles have be scheduled for additions or removal
- return this->handles_to_be_added_ > 0
- || this->handles_to_be_deleted_ > 0
- || this->handles_to_be_suspended_ > 0
+ return this->handles_to_be_added_ > 0
+ || this->handles_to_be_deleted_ > 0
+ || this->handles_to_be_suspended_ > 0
|| this->handles_to_be_resumed_ > 0;
}
@@ -419,7 +419,9 @@ ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1);
int changes_required = 0;
- int result = this->unbind_i (handle, mask, changes_required);
+ int result = this->unbind_i (handle,
+ mask,
+ changes_required);
if (changes_required)
// Wake up all threads in WaitForMultipleObjects so that they can
@@ -548,8 +550,9 @@ ACE_WFMO_Reactor::schedule_wakeup (ACE_HANDLE io_handle,
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
- return this->schedule_wakeup_i (io_handle,
- masks_to_be_added);
+ return this->mask_ops_i (io_handle,
+ masks_to_be_added,
+ ACE_Reactor::ADD_MASK);
}
ACE_INLINE int
@@ -559,8 +562,33 @@ ACE_WFMO_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler,
// This GUARD is necessary since we are updating shared state.
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
- return this->schedule_wakeup_i (event_handler->get_handle (),
- masks_to_be_added);
+ return this->mask_ops_i (event_handler->get_handle (),
+ masks_to_be_added,
+ ACE_Reactor::ADD_MASK);
+}
+
+ACE_INLINE int
+ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle,
+ ACE_Reactor_Mask masks_to_be_removed)
+{
+ // This GUARD is necessary since we are updating shared state.
+ ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
+ return this->mask_ops_i (io_handle,
+ masks_to_be_removed,
+ ACE_Reactor::CLR_MASK);
+}
+
+ACE_INLINE int
+ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
+ ACE_Reactor_Mask masks_to_be_removed)
+{
+ // This GUARD is necessary since we are updating shared state.
+ ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
+
+ return this->mask_ops_i (event_handler->get_handle (),
+ masks_to_be_removed,
+ ACE_Reactor::CLR_MASK);
}
ACE_INLINE int
@@ -590,7 +618,9 @@ ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles,
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
- if (this->handler_rep_.unbind_i (h, mask, changes_required) == -1)
+ if (this->handler_rep_.unbind_i (h,
+ mask,
+ changes_required) == -1)
return -1;
// Wake up all threads in WaitForMultipleObjects so that they can
@@ -601,22 +631,6 @@ ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles,
}
ACE_INLINE int
-ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle,
- ACE_Reactor_Mask masks_to_be_removed)
-{
- return this->remove_handler (io_handle,
- masks_to_be_removed);
-}
-
-ACE_INLINE int
-ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
- ACE_Reactor_Mask masks_to_be_removed)
-{
- return this->remove_handler (event_handler,
- masks_to_be_removed);
-}
-
-ACE_INLINE int
ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle)
{
ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
@@ -675,7 +689,7 @@ ACE_WFMO_Reactor::suspend_handlers (void)
i < this->handler_rep_.max_handlep1_ && error == 0;
i++)
{
- result =
+ result =
this->handler_rep_.suspend_handler_i (this->handler_rep_.current_handles_[i],
changes_required);
if (result == -1)
@@ -963,32 +977,38 @@ ACE_WFMO_Reactor::handler (int signum, ACE_Event_Handler **eh)
return 0;
}
-ACE_INLINE void
-ACE_WFMO_Reactor::requeue_position (int)
+ACE_INLINE int
+ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler,
+ ACE_Reactor_Mask mask,
+ int operation)
{
- // Not implemented
+ ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
+
+ return this->mask_ops_i (event_handler->get_handle (),
+ mask,
+ operation);
}
ACE_INLINE int
-ACE_WFMO_Reactor::requeue_position (void)
+ACE_WFMO_Reactor::mask_ops (ACE_HANDLE io_handle,
+ ACE_Reactor_Mask mask,
+ int operation)
{
- // Don't have an implementation for this yet...
- ACE_NOTSUP_RETURN (-1);
+ ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
+
+ return this->mask_ops_i (io_handle,
+ mask,
+ operation);
}
-ACE_INLINE int
-ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler,
- ACE_Reactor_Mask mask,
- int ops)
+ACE_INLINE void
+ACE_WFMO_Reactor::requeue_position (int)
{
- // Don't have an implementation for this yet...
- ACE_NOTSUP_RETURN (-1);
+ // Not implemented
}
ACE_INLINE int
-ACE_WFMO_Reactor::mask_ops (ACE_HANDLE handle,
- ACE_Reactor_Mask mask,
- int ops)
+ACE_WFMO_Reactor::requeue_position (void)
{
// Don't have an implementation for this yet...
ACE_NOTSUP_RETURN (-1);
@@ -1052,7 +1072,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes (void)
return 0;
}
-ACE_INLINE
+ACE_INLINE
ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void)
{
}