Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_WFMO_Reactor_Handler_Repository Class Reference

Used to map <ACE_HANDLE>s onto the appropriate <ACE_Event_Handler> * and other information. More...

#include <WFMO_Reactor.h>

Collaboration diagram for ACE_WFMO_Reactor_Handler_Repository:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor)
 Constructor. More...

virtual ~ACE_WFMO_Reactor_Handler_Repository (void)
 Destructor. More...

int open (size_t size)
 Initialize the repository of the approriate <size>. More...

int close (void)
 Close down the handler repository. More...

int bind (ACE_HANDLE, ACE_Event_Handler *)
 Bind the <ACE_Event_Handler *> to the <ACE_HANDLE>. This is for the simple event entry. More...

int bind_i (int io_entry, ACE_Event_Handler *event_handler, long network_events, ACE_HANDLE io_handle, ACE_HANDLE event_handle, int delete_event)
 Insert I/O <Event_Handler> entry into the system. This method assumes that the lock are head *before* this method is invoked. More...

int unbind (ACE_HANDLE, ACE_Reactor_Mask mask)
 Remove the binding of <ACE_HANDLE> in accordance with the <mask>. More...

int unbind_i (ACE_HANDLE, ACE_Reactor_Mask mask, int &changes_required)
 Non-lock-grabbing version of <unbind>. More...

void unbind_all (void)
 Remove all bindings of <ACE_HANDLE, ACE_Event_Handler> tuples. More...

int invalid_handle (ACE_HANDLE handle) const
DWORD max_handlep1 (void) const
 Maximum ACE_HANDLE value, plus 1. More...

ACE_HANDLE * handles (void) const
 Pointer to the beginning of the current array of <ACE_HANDLE> *'s. More...

Current_Infocurrent_info (void) const
 Pointer to the beginning of the current array of <ACE_Event_Handler> *'s. More...

virtual int changes_required (void)
 Check if changes to the handle set are required. More...

virtual int make_changes (void)
 Make changes to the handle set. More...

int scheduled_for_deletion (size_t slot) const
 Check to see if <slot> has been scheduled for deletion. More...

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)
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>. More...

int suspend_handler_i (ACE_HANDLE handle, int &changes_required)
 Temporarily suspend entry. More...

int resume_handler_i (ACE_HANDLE handle, int &changes_required)
 Resume suspended entry. More...

int make_changes_in_current_infos (void)
 Deletions and suspensions in current_info_. More...

int make_changes_in_suspension_infos (void)
 Deletions and resumptions in current_suspended_info_. More...

int make_changes_in_to_be_added_infos (void)
 Deletions in to_be_added_info_, or transfers to current_info_ or current_suspended_info_ from to_be_added_info_. More...

int remove_handler_i (size_t slot, ACE_Reactor_Mask mask)
 Removes the <ACE_Event_Handler> at <slot> from the table. More...

int remove_suspended_handler_i (size_t slot, ACE_Reactor_Mask mask)
 Removes the <ACE_Event_Handler> at <slot> from the table. More...

int remove_to_be_added_handler_i (size_t slot, ACE_Reactor_Mask to_be_removed_masks)
 Removes the <ACE_Event_Handler> at <slot> from the table. More...

int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler=0)
void dump (void) const
 Dump the state of an object. More...


Protected Attributes

ACE_WFMO_Reactorwfmo_reactor_
 Reference to our <WFMO_Reactor>. More...

size_t max_size_
 Maximum number of handles. More...

ACE_HANDLE * current_handles_
Current_Infocurrent_info_
 Array of current entries in the table. More...

DWORD max_handlep1_
 A count of the number of active handles. More...

To_Be_Added_Infoto_be_added_info_
 Information for entries to be added. More...

size_t handles_to_be_added_
 Number of records to be added. More...

Suspended_Infocurrent_suspended_info_
 Currently suspended handles. More...

size_t suspended_handles_
 Number of currently suspended handles. More...

size_t handles_to_be_suspended_
 Number of records to be suspended. More...

size_t handles_to_be_resumed_
 Number of records to be resumed. More...

size_t handles_to_be_deleted_
 Number of records to be deleted. More...


Friends

class ACE_WFMO_Reactor
class ACE_WFMO_Reactor_Test

Detailed Description

Used to map <ACE_HANDLE>s onto the appropriate <ACE_Event_Handler> * and other information.

Definition at line 96 of file WFMO_Reactor.h.


Constructor & Destructor Documentation

ACE_WFMO_Reactor_Handler_Repository::ACE_WFMO_Reactor_Handler_Repository ACE_WFMO_Reactor   wfmo_reactor
 

Constructor.

Definition at line 20 of file WFMO_Reactor.cpp.

00021   : wfmo_reactor_ (wfmo_reactor)
00022 {
00023 }

ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository void    [virtual]
 

Destructor.

Definition at line 64 of file WFMO_Reactor.cpp.

References current_handles_, current_info_, current_suspended_info_, and to_be_added_info_.

Referenced by ACE_WFMO_Reactor::open.

00065 {
00066   // Free up dynamically allocated space
00067   delete [] this->current_handles_;
00068   delete [] this->current_info_;
00069   delete [] this->current_suspended_info_;
00070   delete [] this->to_be_added_info_;
00071 }


Member Function Documentation

int ACE_WFMO_Reactor_Handler_Repository::bind ACE_HANDLE   ,
ACE_Event_Handler  
 

Bind the <ACE_Event_Handler *> to the <ACE_HANDLE>. This is for the simple event entry.

int ACE_WFMO_Reactor_Handler_Repository::bind_i int    io_entry,
ACE_Event_Handler   event_handler,
long    network_events,
ACE_HANDLE    io_handle,
ACE_HANDLE    event_handle,
int    delete_event
 

Insert I/O <Event_Handler> entry into the system. This method assumes that the lock are head *before* this method is invoked.

Definition at line 624 of file WFMO_Reactor.cpp.

References ACE_Event_Handler::get_handle, handles_to_be_added_, handles_to_be_deleted_, invalid_handle, max_handlep1_, max_size_, suspended_handles_, to_be_added_info_, ACE_WFMO_Reactor::wakeup_all_threads, and wfmo_reactor_.

Referenced by ACE_WFMO_Reactor::register_handler, and ACE_WFMO_Reactor::register_handler_i.

00630 {
00631   // Make sure that the <handle> is valid
00632   if (event_handle == ACE_INVALID_HANDLE)
00633     event_handle = event_handler->get_handle ();
00634   if (this->invalid_handle (event_handle))
00635     return -1;
00636 
00637   size_t current_size = this->max_handlep1_ +
00638     this->handles_to_be_added_ -
00639     this->handles_to_be_deleted_ +
00640     this->suspended_handles_;
00641 
00642   // Make sure that there's room in the table.
00643   if (current_size < this->max_size_)
00644     {
00645       // Cache this set into the <to_be_added_info_>, till we come
00646       // around to actually adding this to the <current_info_>
00647       this->to_be_added_info_[this->handles_to_be_added_].set (event_handle,
00648                                                                io_entry,
00649                                                                event_handler,
00650                                                                io_handle,
00651                                                                network_events,
00652                                                                delete_event);
00653 
00654       this->handles_to_be_added_++;
00655 
00656       // Wake up all threads in WaitForMultipleObjects so that they can
00657       // reconsult the handle set
00658       this->wfmo_reactor_.wakeup_all_threads ();
00659     }
00660   else
00661     {
00662       errno = EMFILE;   // File descriptor table is full (better than nothing)
00663       return -1;
00664     }
00665 
00666   return 0;
00667 }

ACE_Reactor_Mask ACE_WFMO_Reactor_Handler_Repository::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>.

Definition at line 74 of file WFMO_Reactor.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_BIT_ENABLED, ACE_CLR_BITS, ACE_Reactor_Mask, ACE_SET_BITS, ACE_Reactor::ADD_MASK, ACE_Reactor::CLR_MASK, ACE_Event_Handler::CONNECT_MASK, ACE_Event_Handler::EXCEPT_MASK, FD_GROUP_QOS, FD_QOS, ACE_Reactor::GET_MASK, ACE_Event_Handler::GROUP_QOS_MASK, ACE_Event_Handler::NULL_MASK, ACE_Event_Handler::QOS_MASK, ACE_Event_Handler::READ_MASK, ACE_Reactor::SET_MASK, and ACE_Event_Handler::WRITE_MASK.

Referenced by modify_network_events_i, remove_handler_i, remove_suspended_handler_i, and remove_to_be_added_handler_i.

00077 {
00078   // Find the old reactor masks.  This automatically does the work of
00079   // the GET_MASK operation.
00080 
00081   ACE_Reactor_Mask old_masks = ACE_Event_Handler::NULL_MASK;
00082 
00083   if (ACE_BIT_ENABLED (existing_masks, FD_READ)
00084       || ACE_BIT_ENABLED (existing_masks, FD_CLOSE))
00085     ACE_SET_BITS (old_masks, ACE_Event_Handler::READ_MASK);
00086 
00087   if (ACE_BIT_ENABLED (existing_masks, FD_WRITE))
00088     ACE_SET_BITS (old_masks, ACE_Event_Handler::WRITE_MASK);
00089 
00090   if (ACE_BIT_ENABLED (existing_masks, FD_OOB))
00091     ACE_SET_BITS (old_masks, ACE_Event_Handler::EXCEPT_MASK);
00092 
00093   if (ACE_BIT_ENABLED (existing_masks, FD_ACCEPT))
00094     ACE_SET_BITS (old_masks, ACE_Event_Handler::ACCEPT_MASK);
00095 
00096   if (ACE_BIT_ENABLED (existing_masks, FD_CONNECT))
00097     ACE_SET_BITS (old_masks, ACE_Event_Handler::CONNECT_MASK);
00098 
00099   if (ACE_BIT_ENABLED (existing_masks, FD_QOS))
00100     ACE_SET_BITS (old_masks, ACE_Event_Handler::QOS_MASK);
00101 
00102   if (ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS))
00103     ACE_SET_BITS (old_masks, ACE_Event_Handler::GROUP_QOS_MASK);
00104 
00105   switch (operation)
00106     {
00107     case ACE_Reactor::CLR_MASK:
00108       // For the CLR_MASK operation, clear only the specific masks.
00109 
00110       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK))
00111         {
00112           ACE_CLR_BITS (existing_masks, FD_READ);
00113           ACE_CLR_BITS (existing_masks, FD_CLOSE);
00114         }
00115 
00116       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK))
00117         ACE_CLR_BITS (existing_masks, FD_WRITE);
00118 
00119       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK))
00120         ACE_CLR_BITS (existing_masks, FD_OOB);
00121 
00122       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK))
00123         ACE_CLR_BITS (existing_masks, FD_ACCEPT);
00124 
00125       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK))
00126         ACE_CLR_BITS (existing_masks, FD_CONNECT);
00127 
00128       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK))
00129         ACE_CLR_BITS (existing_masks, FD_QOS);
00130 
00131       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK))
00132         ACE_CLR_BITS (existing_masks, FD_GROUP_QOS);
00133 
00134       break;
00135 
00136     case ACE_Reactor::SET_MASK:
00137       // If the operation is a set, first reset any existing masks
00138 
00139       existing_masks = 0;
00140       /* FALLTHRU */
00141 
00142     case ACE_Reactor::ADD_MASK:
00143       // For the ADD_MASK and the SET_MASK operation, add only the
00144       // specific masks.
00145 
00146       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK))
00147         {
00148           ACE_SET_BITS (existing_masks, FD_READ);
00149           ACE_SET_BITS (existing_masks, FD_CLOSE);
00150         }
00151 
00152       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK))
00153         ACE_SET_BITS (existing_masks, FD_WRITE);
00154 
00155       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK))
00156         ACE_SET_BITS (existing_masks, FD_OOB);
00157 
00158       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK))
00159         ACE_SET_BITS (existing_masks, FD_ACCEPT);
00160 
00161       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK))
00162         ACE_SET_BITS (existing_masks, FD_CONNECT);
00163 
00164       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK))
00165         ACE_SET_BITS (existing_masks, FD_QOS);
00166 
00167       if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK))
00168         ACE_SET_BITS (existing_masks, FD_GROUP_QOS);
00169 
00170       break;
00171 
00172     case ACE_Reactor::GET_MASK:
00173 
00174       // The work for this operation is done in all cases at the
00175       // begining of the function.
00176 
00177       ACE_UNUSED_ARG (change_masks);
00178 
00179       break;
00180     }
00181 
00182   return old_masks;
00183 }

ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::changes_required void    [virtual]
 

Check if changes to the handle set are required.

Definition at line 382 of file WFMO_Reactor.i.

References handles_to_be_added_, handles_to_be_deleted_, handles_to_be_resumed_, and handles_to_be_suspended_.

Referenced by ACE_WFMO_Reactor::open, resume_handler_i, suspend_handler_i, unbind, unbind_i, and ACE_WFMO_Reactor::update_state.

00383 {
00384   // Check if handles have be scheduled for additions or removal
00385   return this->handles_to_be_added_ > 0
00386     || this->handles_to_be_deleted_ > 0
00387     || this->handles_to_be_suspended_ > 0
00388     || this->handles_to_be_resumed_ > 0;
00389 }

ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::close void   
 

Close down the handler repository.

Definition at line 316 of file WFMO_Reactor.i.

References unbind_all.

Referenced by ACE_WFMO_Reactor::close.

00317 {
00318   // Let all the handlers know that the <WFMO_Reactor> is closing down
00319   this->unbind_all ();
00320 
00321   return 0;
00322 }

ACE_INLINE ACE_WFMO_Reactor_Handler_Repository::Current_Info * ACE_WFMO_Reactor_Handler_Repository::current_info void    const
 

Pointer to the beginning of the current array of <ACE_Event_Handler> *'s.

Definition at line 340 of file WFMO_Reactor.i.

References current_info_, ACE_WFMO_Reactor::owner_i, ACE_Thread::self, and wfmo_reactor_.

Referenced by ACE_WFMO_Reactor::complex_dispatch_handler, ACE_WFMO_Reactor::dispatch_handler, and ACE_WFMO_Reactor::simple_dispatch_handler.

00341 {
00342   if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
00343     return this->current_info_;
00344   else
00345     return this->current_info_ + 1;
00346 }

void ACE_WFMO_Reactor_Handler_Repository::dump void    const
 

Dump the state of an object.

Definition at line 935 of file WFMO_Reactor.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump, ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump, handles_to_be_added_, LM_DEBUG, max_handlep1_, suspended_handles_, and to_be_added_info_.

Referenced by ACE_WFMO_Reactor::dump.

00936 {
00937   size_t i = 0;
00938 
00939   ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::dump");
00940 
00941   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00942 
00943   ACE_DEBUG ((LM_DEBUG,
00944               ACE_LIB_TEXT ("Max size = %d\n"),
00945               this->max_size_));
00946 
00947   ACE_DEBUG ((LM_DEBUG,
00948               ACE_LIB_TEXT ("Current info table\n\n")));
00949   ACE_DEBUG ((LM_DEBUG,
00950               ACE_LIB_TEXT ("\tSize = %d\n"),
00951               this->max_handlep1_));
00952   ACE_DEBUG ((LM_DEBUG,
00953               ACE_LIB_TEXT ("\tHandles to be suspended = %d\n"),
00954               this->handles_to_be_suspended_));
00955 
00956   for (i = 0; i < this->max_handlep1_; i++)
00957     this->current_info_[i].dump (this->current_handles_[i]);
00958 
00959   ACE_DEBUG ((LM_DEBUG,
00960               ACE_LIB_TEXT ("\n")));
00961 
00962   ACE_DEBUG ((LM_DEBUG,
00963               ACE_LIB_TEXT ("To-be-added info table\n\n")));
00964   ACE_DEBUG ((LM_DEBUG,
00965               ACE_LIB_TEXT ("\tSize = %d\n"),
00966               this->handles_to_be_added_));
00967 
00968   for (i = 0; i < this->handles_to_be_added_; i++)
00969     this->to_be_added_info_[i].dump ();
00970 
00971   ACE_DEBUG ((LM_DEBUG,
00972               ACE_LIB_TEXT ("\n")));
00973 
00974   ACE_DEBUG ((LM_DEBUG,
00975               ACE_LIB_TEXT ("Suspended info table\n\n")));
00976   ACE_DEBUG ((LM_DEBUG,
00977               ACE_LIB_TEXT ("\tSize = %d\n"),
00978               this->suspended_handles_));
00979   ACE_DEBUG ((LM_DEBUG,
00980               ACE_LIB_TEXT ("\tHandles to be resumed = %d\n"),
00981               this->handles_to_be_resumed_));
00982 
00983   for (i = 0; i < this->suspended_handles_; i++)
00984     this->current_suspended_info_[i].dump ();
00985 
00986   ACE_DEBUG ((LM_DEBUG,
00987               ACE_LIB_TEXT ("\n")));
00988 
00989   ACE_DEBUG ((LM_DEBUG,
00990               ACE_LIB_TEXT ("Total handles to be deleted = %d\n"),
00991               this->handles_to_be_deleted_));
00992 
00993   ACE_DEBUG ((LM_DEBUG,
00994               ACE_END_DUMP));
00995 }

int ACE_WFMO_Reactor_Handler_Repository::handler ACE_HANDLE    handle,
ACE_Reactor_Mask    mask,
ACE_Event_Handler **    event_handler = 0
 

Check to see if <handle> is associated with a valid Event_Handler bound to <mask>. Return the <event_handler> associated with this <handler> if <event_handler> != 0.

Definition at line 1472 of file WFMO_Reactor.cpp.

References ACE_Event_Handler::ACCEPT_MASK, ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_Event_Handler::CONNECT_MASK, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::EXCEPT_MASK, FD_GROUP_QOS, FD_QOS, ACE_Event_Handler::GROUP_QOS_MASK, handles_to_be_added_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::network_events_, ACE_Event_Handler::QOS_MASK, ACE_Event_Handler::READ_MASK, suspended_handles_, to_be_added_info_, and ACE_Event_Handler::WRITE_MASK.

Referenced by ACE_WFMO_Reactor::handler.

01475 {
01476   int found = 0;
01477   size_t i = 0;
01478   ACE_Event_Handler *event_handler = 0;
01479   long existing_masks = 0;
01480 
01481   // Look for the handle first
01482 
01483   // First go through the current entries
01484   //
01485   // Look for all entries in the current handles for matching handle
01486   // (except those that have been scheduled for deletion)
01487   for (i = 0; i < this->max_handlep1_ && !found; i++)
01488     if ((handle == this->current_info_[i].io_handle_ ||
01489          handle == this->current_handles_[i]) &&
01490         !this->current_info_[i].delete_entry_)
01491       {
01492         found = 1;
01493         event_handler = this->current_info_[i].event_handler_;
01494         existing_masks = this->current_info_[i].network_events_;
01495       }
01496 
01497   // Then pass through the suspended handles
01498   //
01499   // Look for all entries in the suspended handles for matching handle
01500   // (except those that have been scheduled for deletion)
01501   for (i = 0; i < this->suspended_handles_ && !found; i++)
01502     if ((handle == this->current_suspended_info_[i].io_handle_ ||
01503          handle == this->current_suspended_info_[i].event_handle_) &&
01504         !this->current_suspended_info_[i].delete_entry_)
01505       {
01506         found = 1;
01507         event_handler = this->current_suspended_info_[i].event_handler_;
01508         existing_masks = this->current_suspended_info_[i].network_events_;
01509       }
01510 
01511   // Then check the to_be_added handles
01512   //
01513   // Look for all entries in the to_be_added handles for matching
01514   // handle (except those that have been scheduled for deletion)
01515   for (i = 0; i < this->handles_to_be_added_ && !found; i++)
01516     if ((handle == this->to_be_added_info_[i].io_handle_ ||
01517          handle == this->to_be_added_info_[i].event_handle_) &&
01518         !this->to_be_added_info_[i].delete_entry_)
01519       {
01520         found = 1;
01521         event_handler = this->to_be_added_info_[i].event_handler_;
01522         existing_masks = this->to_be_added_info_[i].network_events_;
01523       }
01524 
01525   // If the handle is not found, return failure.
01526   if (!found)
01527     return -1;
01528 
01529   // Otherwise, make sure that the masks that the user is looking for
01530   // are on.
01531   if (found &&
01532       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::READ_MASK))
01533     if (!ACE_BIT_ENABLED (existing_masks, FD_READ)
01534         && !ACE_BIT_ENABLED (existing_masks, FD_CLOSE))
01535       found = 0;
01536 
01537   if (found &&
01538       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::WRITE_MASK))
01539     if (!ACE_BIT_ENABLED (existing_masks, FD_WRITE))
01540       found = 0;
01541 
01542   if (found &&
01543       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::EXCEPT_MASK))
01544     if (!ACE_BIT_ENABLED (existing_masks, FD_OOB))
01545       found = 0;
01546 
01547   if (found &&
01548       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::ACCEPT_MASK))
01549     if (!ACE_BIT_ENABLED (existing_masks, FD_ACCEPT))
01550       found = 0;
01551 
01552   if (found &&
01553       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::CONNECT_MASK))
01554     if (!ACE_BIT_ENABLED (existing_masks, FD_CONNECT))
01555       found = 0;
01556 
01557   if (found &&
01558       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::QOS_MASK))
01559     if (!ACE_BIT_ENABLED (existing_masks, FD_QOS))
01560       found = 0;
01561 
01562   if (found &&
01563       ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::GROUP_QOS_MASK))
01564     if (!ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS))
01565       found = 0;
01566 
01567   if (found &&
01568       user_event_handler)
01569     *user_event_handler = event_handler;
01570 
01571   if (found)
01572     return 0;
01573   else
01574     return -1;
01575 }

ACE_INLINE ACE_HANDLE * ACE_WFMO_Reactor_Handler_Repository::handles void    const
 

Pointer to the beginning of the current array of <ACE_HANDLE> *'s.

Definition at line 325 of file WFMO_Reactor.i.

References current_handles_, ACE_WFMO_Reactor::owner_i, ACE_Thread::self, and wfmo_reactor_.

Referenced by ACE_WFMO_Reactor::dispatch_handler, ACE_WFMO_Reactor::poll_remaining_handles, ACE_Msg_WFMO_Reactor::poll_remaining_handles, ACE_WFMO_Reactor::wait_for_multiple_events, and ACE_Msg_WFMO_Reactor::wait_for_multiple_events.

00326 {
00327   // This code is probably too subtle to be useful in the long run...
00328   // The basic idea is that all threads wait on all user handles plus
00329   // the <wakeup_all_threads_> handle. The owner thread additional
00330   // waits on the <notify_> handle. This is to ensure that only the
00331   // <owner_> thread get to expire timers and handle event on the
00332   // notify pipe.
00333   if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
00334     return this->current_handles_;
00335   else
00336     return this->current_handles_ + 1;
00337 }

ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::invalid_handle ACE_HANDLE    handle const
 

Definition at line 367 of file WFMO_Reactor.i.

References ACE_TRACE.

Referenced by bind_i, ACE_WFMO_Reactor::mask_ops_i, ACE_WFMO_Reactor::register_handler_i, and unbind.

00368 {
00369   ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::invalid_handle");
00370   // It's too expensive to perform more exhaustive validity checks on
00371   // Win32 due to the way that they implement SOCKET HANDLEs.
00372   if (handle == ACE_INVALID_HANDLE)
00373     {
00374       errno = EINVAL;
00375       return 1;
00376     }
00377   else
00378     return 0;
00379 }

ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::make_changes void    [virtual]
 

Make changes to the handle set.

Definition at line 392 of file WFMO_Reactor.i.

References make_changes_in_current_infos, make_changes_in_suspension_infos, and make_changes_in_to_be_added_infos.

Referenced by ACE_WFMO_Reactor::open, ACE_WFMO_Reactor::update_state, and ACE_WFMO_Reactor::~ACE_WFMO_Reactor.

00393 {
00394   // This method must ONLY be called by the
00395   // <WFMO_Reactor->change_state_thread_>. We therefore assume that
00396   // there will be no contention for this method and hence no guards
00397   // are neccessary.
00398 
00399   // Deletions and suspensions in current_info_
00400   this->make_changes_in_current_infos ();
00401 
00402   // Deletions and resumptions in current_suspended_info_
00403   this->make_changes_in_suspension_infos ();
00404 
00405   // Deletions in to_be_added_info_, or transfers to current_info_ or
00406   // current_suspended_info_ from to_be_added_info_
00407   this->make_changes_in_to_be_added_infos ();
00408 
00409   return 0;
00410 }

int ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos void   
 

Deletions and suspensions in current_info_.

Definition at line 670 of file WFMO_Reactor.cpp.

References ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_WFMO_Reactor_Handler_Repository::Common_Info::close_masks_, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_event_, ACE_Event_Handler::DONT_CALL, ACE_OS::event_destroy, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::handle_close, handles_to_be_deleted_, handles_to_be_suspended_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_Event_Handler::NULL_MASK, ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset, ACE_WFMO_Reactor_Handler_Repository::Current_Info::suspend_entry_, and suspended_handles_.

Referenced by make_changes.

00671 {
00672   // Go through the entire valid array and check for all handles that
00673   // have been schedule for deletion
00674   if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_suspended_ > 0)
00675     {
00676       for (size_t i = 0; i < this->max_handlep1_; i++)
00677         {
00678           // This stuff is necessary here, since we should not make
00679           // the upcall until all the internal data structures have
00680           // been updated.  This is to protect against upcalls that
00681           // try to deregister again.
00682           ACE_HANDLE handle = ACE_INVALID_HANDLE;
00683           ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK;
00684           ACE_Event_Handler *event_handler = 0;
00685 
00686           // See if this entry is scheduled for deletion
00687           if (this->current_info_[i].delete_entry_)
00688             {
00689               // Calling the <handle_close> method here will ensure that we
00690               // will only call it once per deregistering <Event_Handler>.
00691               // This is essential in the case when the <Event_Handler> will
00692               // do something like delete itself and we have multiple
00693               // threads in WFMO_Reactor.
00694               //
00695               // Make sure that the DONT_CALL mask is not set
00696               masks = this->current_info_[i].close_masks_;
00697               if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0)
00698                 {
00699                   // Grab the correct handle depending on the type entry
00700                   if (this->current_info_[i].io_entry_)
00701                     handle = this->current_info_[i].io_handle_;
00702                   else
00703                     handle = this->current_handles_[i];
00704 
00705                   // Event handler
00706                   event_handler = this->current_info_[i].event_handler_;
00707                 }
00708 
00709               // If <WFMO_Reactor> created the event, we need to clean it up
00710               if (this->current_info_[i].delete_event_)
00711                 ACE_OS::event_destroy (&this->current_handles_[i]);
00712 
00713               // Reduce count by one
00714               this->handles_to_be_deleted_--;
00715             }
00716 
00717           // See if this entry is scheduled for suspension
00718           else if (this->current_info_[i].suspend_entry_)
00719             {
00720               this->current_suspended_info_ [this->suspended_handles_].set (this->current_handles_[i],
00721                                                                             this->current_info_[i]);
00722               // Increase number of suspended handles
00723               this->suspended_handles_++;
00724 
00725               // Reduce count by one
00726               this->handles_to_be_suspended_--;
00727             }
00728 
00729           // See if this entry is scheduled for deletion or suspension
00730           // If so we need to clean up
00731           if (this->current_info_[i].delete_entry_ ||
00732               this->current_info_[i].suspend_entry_  )
00733             {
00734               size_t last_valid_slot = this->max_handlep1_ - 1;
00735               // If this is the last handle in the set, no need to swap
00736               // places. Simply remove it.
00737               if (i < last_valid_slot)
00738                 // Swap this handle with the last valid handle
00739                 {
00740                   // Struct copy
00741                   this->current_info_[i] =
00742                     this->current_info_[last_valid_slot];
00743                   this->current_handles_[i] =
00744                     this->current_handles_[last_valid_slot];
00745                 }
00746               // Reset the info in this slot
00747               this->current_info_[last_valid_slot].reset ();
00748               this->current_handles_[last_valid_slot] = ACE_INVALID_HANDLE;
00749               this->max_handlep1_--;
00750             }
00751 
00752           // Now that all internal structures have been updated, make
00753           // the upcall.
00754           if (event_handler != 0)
00755             event_handler->handle_close (handle, masks);
00756         }
00757     }
00758 
00759   return 0;
00760 }

int ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos void   
 

Deletions and resumptions in current_suspended_info_.

Definition at line 763 of file WFMO_Reactor.cpp.

References ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_WFMO_Reactor_Handler_Repository::Common_Info::close_masks_, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_event_, ACE_Event_Handler::DONT_CALL, ACE_OS::event_destroy, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::handle_close, handles_to_be_deleted_, handles_to_be_resumed_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_Event_Handler::NULL_MASK, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::resume_entry_, and suspended_handles_.

Referenced by make_changes.

00764 {
00765   // Go through the <suspended_handle> array
00766   if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_resumed_ > 0)
00767     {
00768       for (size_t i = 0; i < this->suspended_handles_; i++)
00769         {
00770           // This stuff is necessary here, since we should not make
00771           // the upcall until all the internal data structures have
00772           // been updated.  This is to protect against upcalls that
00773           // try to deregister again.
00774           ACE_HANDLE handle = ACE_INVALID_HANDLE;
00775           ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK;
00776           ACE_Event_Handler *event_handler = 0;
00777 
00778           // See if this entry is scheduled for deletion
00779           if (this->current_suspended_info_[i].delete_entry_)
00780             {
00781               // Calling the <handle_close> method here will ensure that we
00782               // will only call it once per deregistering <Event_Handler>.
00783               // This is essential in the case when the <Event_Handler> will
00784               // do something like delete itself and we have multiple
00785               // threads in WFMO_Reactor.
00786               //
00787               // Make sure that the DONT_CALL mask is not set
00788               masks = this->current_suspended_info_[i].close_masks_;
00789               if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0)
00790                 {
00791                   // Grab the correct handle depending on the type entry
00792                   if (this->current_suspended_info_[i].io_entry_)
00793                     handle = this->current_suspended_info_[i].io_handle_;
00794                   else
00795                     handle = this->current_suspended_info_[i].event_handle_;
00796 
00797                   // Upcall
00798                   event_handler = this->current_suspended_info_[i].event_handler_;
00799                 }
00800 
00801               // If <WFMO_Reactor> created the event, we need to clean it up
00802               if (this->current_suspended_info_[i].delete_event_)
00803                 ACE_OS::event_destroy (&this->current_suspended_info_[i].event_handle_);
00804 
00805               // Reduce count by one
00806               this->handles_to_be_deleted_--;
00807             }
00808 
00809           else if (this->current_suspended_info_[i].resume_entry_)
00810             {
00811               // Add to the end of the current handles set
00812               this->current_handles_[this->max_handlep1_] = this->current_suspended_info_[i].event_handle_;
00813               // Struct copy
00814               this->current_info_[this->max_handlep1_].set (this->current_suspended_info_[i]);
00815               this->max_handlep1_++;
00816 
00817               // Reduce count by one
00818               this->handles_to_be_resumed_--;
00819             }
00820 
00821           // If an entry needs to be removed, either because it
00822           // was deleted or resumed, remove it now before doing
00823           // the upcall.
00824           if (this->current_suspended_info_[i].resume_entry_ ||
00825               this->current_suspended_info_[i].delete_entry_)
00826             {
00827               size_t last_valid_slot = this->suspended_handles_ - 1;
00828               // Net effect is that we're removing an entry and
00829               // compressing the list from the end.  So, if removing
00830               // an entry from the middle, copy the last valid one to the
00831               // removed slot.  Reset the end and decrement the number
00832               // of suspended handles.
00833               if (i < last_valid_slot)
00834                 // Struct copy
00835                 this->current_suspended_info_[i] =
00836                   this->current_suspended_info_[last_valid_slot];
00837               this->current_suspended_info_[last_valid_slot].reset ();
00838               this->suspended_handles_--;
00839             }
00840 
00841           // Now that all internal structures have been updated, make
00842           // the upcall.
00843           if (event_handler != 0)
00844             event_handler->handle_close (handle, masks);
00845         }
00846     }
00847 
00848   return 0;
00849 }

int ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos void   
 

Deletions in to_be_added_info_, or transfers to current_info_ or current_suspended_info_ from to_be_added_info_.

Definition at line 852 of file WFMO_Reactor.cpp.

References ACE_BIT_ENABLED, ACE_Reactor_Mask, ACE_WFMO_Reactor_Handler_Repository::Common_Info::close_masks_, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_event_, ACE_Event_Handler::DONT_CALL, ACE_OS::event_destroy, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::handle_close, handles_to_be_added_, handles_to_be_deleted_, handles_to_be_suspended_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_Event_Handler::NULL_MASK, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::suspend_entry_, suspended_handles_, and to_be_added_info_.

Referenced by make_changes.

00853 {
00854   // Go through the <to_be_added_*> arrays
00855   for (size_t i = 0; i < this->handles_to_be_added_; i++)
00856     {
00857       // This stuff is necessary here, since we should not make
00858       // the upcall until all the internal data structures have
00859       // been updated.  This is to protect against upcalls that
00860       // try to deregister again.
00861       ACE_HANDLE handle = ACE_INVALID_HANDLE;
00862       ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK;
00863       ACE_Event_Handler *event_handler = 0;
00864 
00865       // See if this entry is scheduled for deletion
00866       if (this->to_be_added_info_[i].delete_entry_)
00867         {
00868           // Calling the <handle_close> method here will ensure that we
00869           // will only call it once per deregistering <Event_Handler>.
00870           // This is essential in the case when the <Event_Handler> will
00871           // do something like delete itself and we have multiple
00872           // threads in WFMO_Reactor.
00873           //
00874           // Make sure that the DONT_CALL mask is not set
00875           masks = this->to_be_added_info_[i].close_masks_;
00876           if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0)
00877             {
00878               // Grab the correct handle depending on the type entry
00879               if (this->to_be_added_info_[i].io_entry_)
00880                 handle = this->to_be_added_info_[i].io_handle_;
00881               else
00882                 handle = this->to_be_added_info_[i].event_handle_;
00883 
00884               // Upcall
00885               event_handler = this->to_be_added_info_[i].event_handler_;
00886             }
00887 
00888           // If <WFMO_Reactor> created the event, we need to clean it up
00889           if (this->to_be_added_info_[i].delete_event_)
00890             ACE_OS::event_destroy (&this->to_be_added_info_[i].event_handle_);
00891 
00892           // Reduce count by one
00893           this->handles_to_be_deleted_--;
00894         }
00895 
00896       // See if this entry is scheduled for suspension
00897       else if (this->to_be_added_info_[i].suspend_entry_)
00898         {
00899           this->current_suspended_info_ [this->suspended_handles_].set (this->to_be_added_info_[i].event_handle_,
00900                                                                         this->to_be_added_info_[i]);
00901           // Increase number of suspended handles
00902           this->suspended_handles_++;
00903 
00904           // Reduce count by one
00905           this->handles_to_be_suspended_--;
00906         }
00907 
00908       // If neither of the two flags are on, add to current
00909       else
00910         {
00911           // Add to the end of the current handles set
00912           this->current_handles_[this->max_handlep1_] = this->to_be_added_info_[i].event_handle_;
00913           // Struct copy
00914           this->current_info_[this->max_handlep1_].set (this->to_be_added_info_[i]);
00915           this->max_handlep1_++;
00916         }
00917 
00918       // Reset the <to_be_added_info_>
00919       this->to_be_added_info_[i].reset ();
00920 
00921       // Now that all internal structures have been updated, make the
00922       // upcall.
00923       if (event_handler != 0)
00924         event_handler->handle_close (handle, masks);
00925     }
00926 
00927   // Since all to be added handles have been taken care of, reset the
00928   // counter
00929   this->handles_to_be_added_ = 0;
00930 
00931   return 0;
00932 }

ACE_INLINE DWORD ACE_WFMO_Reactor_Handler_Repository::max_handlep1 void    const
 

Maximum ACE_HANDLE value, plus 1.

Definition at line 349 of file WFMO_Reactor.i.

References max_handlep1_, ACE_WFMO_Reactor::owner_i, ACE_Thread::self, and wfmo_reactor_.

Referenced by ACE_WFMO_Reactor::dispatch_handles.

00350 {
00351   if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
00352     return this->max_handlep1_;
00353   else
00354     return this->max_handlep1_ - 1;
00355 }

int 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
 

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

Definition at line 1408 of file WFMO_Reactor.cpp.

References ACE_Reactor_Mask, bit_ops, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_event_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, handles_to_be_added_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::network_events_, suspended_handles_, and to_be_added_info_.

Referenced by ACE_WFMO_Reactor::mask_ops_i, and ACE_WFMO_Reactor::register_handler_i.

01415 {
01416   long *modified_network_events = &new_network_events;
01417   int found = 0;
01418   size_t i;
01419 
01420   // First go through the current entries
01421   //
01422   // Look for all entries in the current handles for matching handle
01423   // (except those that have been scheduled for deletion)
01424   for (i = 0; i < this->max_handlep1_ && !found; i++)
01425     if (io_handle == this->current_info_[i].io_handle_ &&
01426         !this->current_info_[i].delete_entry_)
01427       {
01428         found = 1;
01429         modified_network_events = &this->current_info_[i].network_events_;
01430         delete_event = this->current_info_[i].delete_event_;
01431         event_handle = this->current_handles_[i];
01432       }
01433 
01434   // Then pass through the suspended handles
01435   //
01436   // Look for all entries in the suspended handles for matching handle
01437   // (except those that have been scheduled for deletion)
01438   for (i = 0; i < this->suspended_handles_ && !found; i++)
01439     if (io_handle == this->current_suspended_info_[i].io_handle_ &&
01440         !this->current_suspended_info_[i].delete_entry_)
01441       {
01442         found = 1;
01443         modified_network_events = &this->current_suspended_info_[i].network_events_;
01444         delete_event = this->current_suspended_info_[i].delete_event_;
01445         event_handle = this->current_suspended_info_[i].event_handle_;
01446       }
01447 
01448   // Then check the to_be_added handles
01449   //
01450   // Look for all entries in the to_be_added handles for matching
01451   // handle (except those that have been scheduled for deletion)
01452   for (i = 0; i < this->handles_to_be_added_ && !found; i++)
01453     if (io_handle == this->to_be_added_info_[i].io_handle_ &&
01454         !this->to_be_added_info_[i].delete_entry_)
01455       {
01456         found = 1;
01457         modified_network_events = &this->to_be_added_info_[i].network_events_;
01458         delete_event = this->to_be_added_info_[i].delete_event_;
01459         event_handle = this->to_be_added_info_[i].event_handle_;
01460       }
01461 
01462   old_masks = this->bit_ops (*modified_network_events,
01463                              new_masks,
01464                              operation);
01465 
01466   new_network_events = *modified_network_events;
01467 
01468   return found;
01469 }

int ACE_WFMO_Reactor_Handler_Repository::open size_t    size
 

Initialize the repository of the approriate <size>.

Definition at line 26 of file WFMO_Reactor.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NEW_RETURN, current_handles_, handles_to_be_added_, handles_to_be_deleted_, handles_to_be_resumed_, handles_to_be_suspended_, LM_ERROR, max_handlep1_, max_size_, and suspended_handles_.

Referenced by ACE_WFMO_Reactor::open.

00027 {
00028   if (size > MAXIMUM_WAIT_OBJECTS)
00029     ACE_ERROR_RETURN ((LM_ERROR,
00030                        ACE_LIB_TEXT ("%d exceeds MAXIMUM_WAIT_OBJECTS (%d)\n"),
00031                        size,
00032                        MAXIMUM_WAIT_OBJECTS),
00033                       -1);
00034 
00035   // Dynamic allocation
00036   ACE_NEW_RETURN (this->current_handles_,
00037                   ACE_HANDLE[size],
00038                   -1);
00039   ACE_NEW_RETURN (this->current_info_,
00040                   Current_Info[size],
00041                   -1);
00042   ACE_NEW_RETURN (this->current_suspended_info_,
00043                   Suspended_Info[size],
00044                   -1);
00045   ACE_NEW_RETURN (this->to_be_added_info_,
00046                   To_Be_Added_Info[size],
00047                   -1);
00048 
00049   // Initialization
00050   this->max_size_ = size;
00051   this->max_handlep1_ = 0;
00052   this->suspended_handles_ = 0;
00053   this->handles_to_be_added_ = 0;
00054   this->handles_to_be_deleted_ = 0;
00055   this->handles_to_be_suspended_ = 0;
00056   this->handles_to_be_resumed_ = 0;
00057 
00058   for (size_t i = 0; i < size; i++)
00059     this->current_handles_[i] = ACE_INVALID_HANDLE;
00060 
00061   return 0;
00062 }

int ACE_WFMO_Reactor_Handler_Repository::remove_handler_i size_t    slot,
ACE_Reactor_Mask    mask
 

Removes the <ACE_Event_Handler> at <slot> from the table.

Definition at line 258 of file WFMO_Reactor.cpp.

References ACE_BIT_ENABLED, ACE_Reactor_Mask, bit_ops, ACE_WFMO_Reactor_Handler_Repository::Common_Info::close_masks_, ACE_Reactor::CLR_MASK, current_handles_, current_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_Event_Handler::DONT_CALL, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::handle_close, handles_to_be_deleted_, handles_to_be_suspended_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::network_events_, ACE_Event_Handler::NULL_MASK, and ACE_WFMO_Reactor_Handler_Repository::Current_Info::suspend_entry_.

Referenced by unbind_i.

00260 {
00261   // I/O entries
00262   if (this->current_info_[slot].io_entry_)
00263     {
00264       // See if there are other events that the <Event_Handler> is
00265       // interested in
00266       this->bit_ops (this->current_info_[slot].network_events_,
00267                      to_be_removed_masks,
00268                      ACE_Reactor::CLR_MASK);
00269 
00270       // Disassociate/Reassociate the event from/with the I/O handle.
00271       // This will depend on the value of remaining set of network
00272       // events that the <event_handler> is interested in. I don't
00273       // think we can do anything about errors here, so I will not
00274       // check this.
00275       ::WSAEventSelect ((SOCKET) this->current_info_[slot].io_handle_,
00276                         this->current_handles_[slot],
00277                         this->current_info_[slot].network_events_);
00278     }
00279   // Normal event entries.
00280   else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL))
00281     // Preserve DONT_CALL
00282     to_be_removed_masks = ACE_Event_Handler::DONT_CALL;
00283   else
00284     // Make sure that the <to_be_removed_masks> is the NULL_MASK
00285     to_be_removed_masks = ACE_Event_Handler::NULL_MASK;
00286 
00287   // If this event was marked for suspension, undo the suspension flag
00288   // and reduce the to be suspended count.
00289   if (this->current_info_[slot].suspend_entry_)
00290     {
00291       // Undo suspension
00292       this->current_info_[slot].suspend_entry_ = 0;
00293       // Decrement the handle count
00294       this->handles_to_be_suspended_--;
00295     }
00296 
00297   // If there are no more events that the <Event_Handler> is
00298   // interested in, or this is a non-I/O entry, schedule the
00299   // <Event_Handler> for removal
00300   if (this->current_info_[slot].network_events_ == 0)
00301     {
00302       // Mark to be deleted
00303       this->current_info_[slot].delete_entry_ = 1;
00304       // Remember the mask
00305       this->current_info_[slot].close_masks_ = to_be_removed_masks;
00306       // Increment the handle count
00307       this->handles_to_be_deleted_++;
00308     }
00309 
00310   // Since it is not a complete removal, we'll call handle_close
00311   // for all the masks that were removed.  This does not change
00312   // the internal state of the reactor.
00313   //
00314   // Note: this condition only applies to I/O entries
00315   else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0)
00316     {
00317       ACE_HANDLE handle = this->current_info_[slot].io_handle_;
00318       this->current_info_[slot].event_handler_->handle_close (handle,
00319                                                               to_be_removed_masks);
00320     }
00321 
00322   return 0;
00323 }

int ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i size_t    slot,
ACE_Reactor_Mask    mask
 

Removes the <ACE_Event_Handler> at <slot> from the table.

Definition at line 326 of file WFMO_Reactor.cpp.

References ACE_BIT_ENABLED, ACE_Reactor_Mask, bit_ops, ACE_WFMO_Reactor_Handler_Repository::Common_Info::close_masks_, ACE_Reactor::CLR_MASK, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_Event_Handler::DONT_CALL, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::handle_close, handles_to_be_deleted_, handles_to_be_resumed_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::network_events_, ACE_Event_Handler::NULL_MASK, and ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::resume_entry_.

Referenced by unbind_i.

00328 {
00329   // I/O entries
00330   if (this->current_suspended_info_[slot].io_entry_)
00331     {
00332       // See if there are other events that the <Event_Handler> is
00333       // interested in
00334       this->bit_ops (this->current_suspended_info_[slot].network_events_,
00335                      to_be_removed_masks,
00336                      ACE_Reactor::CLR_MASK);
00337 
00338       // Disassociate/Reassociate the event from/with the I/O handle.
00339       // This will depend on the value of remaining set of network
00340       // events that the <event_handler> is interested in. I don't
00341       // think we can do anything about errors here, so I will not
00342       // check this.
00343       ::WSAEventSelect ((SOCKET) this->current_suspended_info_[slot].io_handle_,
00344                         this->current_suspended_info_[slot].event_handle_,
00345                         this->current_suspended_info_[slot].network_events_);
00346     }
00347   // Normal event entries.
00348   else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL))
00349     // Preserve DONT_CALL
00350     to_be_removed_masks = ACE_Event_Handler::DONT_CALL;
00351   else
00352     // Make sure that the <to_be_removed_masks> is the NULL_MASK
00353     to_be_removed_masks = ACE_Event_Handler::NULL_MASK;
00354 
00355   // If this event was marked for resumption, undo the resumption flag
00356   // and reduce the to be resumed count.
00357   if (this->current_suspended_info_[slot].resume_entry_)
00358     {
00359       // Undo resumption
00360       this->current_suspended_info_[slot].resume_entry_ = 0;
00361       // Decrement the handle count
00362       this->handles_to_be_resumed_--;
00363     }
00364 
00365   // If there are no more events that the <Event_Handler> is
00366   // interested in, or this is a non-I/O entry, schedule the
00367   // <Event_Handler> for removal
00368   if (this->current_suspended_info_[slot].network_events_ == 0)
00369     {
00370       // Mark to be deleted
00371       this->current_suspended_info_[slot].delete_entry_ = 1;
00372       // Remember the mask
00373       this->current_suspended_info_[slot].close_masks_ = to_be_removed_masks;
00374       // Increment the handle count
00375       this->handles_to_be_deleted_++;
00376     }
00377   // Since it is not a complete removal, we'll call handle_close for
00378   // all the masks that were removed.  This does not change the
00379   // internal state of the reactor.
00380   //
00381   // Note: this condition only applies to I/O entries
00382   else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0)
00383     {
00384       ACE_HANDLE handle = this->current_suspended_info_[slot].io_handle_;
00385       this->current_suspended_info_[slot].event_handler_->handle_close (handle,
00386                                                                         to_be_removed_masks);
00387     }
00388 
00389   return 0;
00390 }

int ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i size_t    slot,
ACE_Reactor_Mask    to_be_removed_masks
 

Removes the <ACE_Event_Handler> at <slot> from the table.

Definition at line 393 of file WFMO_Reactor.cpp.

References ACE_BIT_ENABLED, ACE_Reactor_Mask, bit_ops, ACE_WFMO_Reactor_Handler_Repository::Common_Info::close_masks_, ACE_Reactor::CLR_MASK, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_Event_Handler::DONT_CALL, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::event_handler_, ACE_Event_Handler::handle_close, handles_to_be_deleted_, handles_to_be_suspended_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_entry_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::network_events_, ACE_Event_Handler::NULL_MASK, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::suspend_entry_, and to_be_added_info_.

Referenced by unbind_i.

00395 {
00396   // I/O entries
00397   if (this->to_be_added_info_[slot].io_entry_)
00398     {
00399       // See if there are other events that the <Event_Handler> is
00400       // interested in
00401       this->bit_ops (this->to_be_added_info_[slot].network_events_,
00402                      to_be_removed_masks,
00403                      ACE_Reactor::CLR_MASK);
00404 
00405       // Disassociate/Reassociate the event from/with the I/O handle.
00406       // This will depend on the value of remaining set of network
00407       // events that the <event_handler> is interested in. I don't
00408       // think we can do anything about errors here, so I will not
00409       // check this.
00410       ::WSAEventSelect ((SOCKET) this->to_be_added_info_[slot].io_handle_,
00411                         this->to_be_added_info_[slot].event_handle_,
00412                         this->to_be_added_info_[slot].network_events_);
00413     }
00414   // Normal event entries.
00415   else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL))
00416     // Preserve DONT_CALL
00417     to_be_removed_masks = ACE_Event_Handler::DONT_CALL;
00418   else
00419     // Make sure that the <to_be_removed_masks> is the NULL_MASK
00420     to_be_removed_masks = ACE_Event_Handler::NULL_MASK;
00421 
00422   // If this event was marked for suspension, undo the suspension flag
00423   // and reduce the to be suspended count.
00424   if (this->to_be_added_info_[slot].suspend_entry_)
00425     {
00426       // Undo suspension
00427       this->to_be_added_info_[slot].suspend_entry_ = 0;
00428       // Decrement the handle count
00429       this->handles_to_be_suspended_--;
00430     }
00431 
00432   // If there are no more events that the <Event_Handler> is
00433   // interested in, or this is a non-I/O entry, schedule the
00434   // <Event_Handler> for removal
00435   if (this->to_be_added_info_[slot].network_events_ == 0)
00436     {
00437       // Mark to be deleted
00438       this->to_be_added_info_[slot].delete_entry_ = 1;
00439       // Remember the mask
00440       this->to_be_added_info_[slot].close_masks_ = to_be_removed_masks;
00441       // Increment the handle count
00442       this->handles_to_be_deleted_++;
00443     }
00444   // Since it is not a complete removal, we'll call handle_close
00445   // for all the masks that were removed.  This does not change
00446   // the internal state of the reactor.
00447   //
00448   // Note: this condition only applies to I/O entries
00449   else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0)
00450     {
00451       ACE_HANDLE handle = this->to_be_added_info_[slot].io_handle_;
00452       this->to_be_added_info_[slot].event_handler_->handle_close (handle,
00453                                                                   to_be_removed_masks);
00454     }
00455 
00456   return 0;
00457 }

int ACE_WFMO_Reactor_Handler_Repository::resume_handler_i ACE_HANDLE    handle,
int &    changes_required
 

Resume suspended entry.

Definition at line 524 of file WFMO_Reactor.cpp.

References changes_required, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, handles_to_be_added_, handles_to_be_resumed_, handles_to_be_suspended_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::resume_entry_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::suspend_entry_, ACE_WFMO_Reactor_Handler_Repository::Current_Info::suspend_entry_, suspended_handles_, and to_be_added_info_.

Referenced by ACE_WFMO_Reactor::resume_handler, and ACE_WFMO_Reactor::resume_handlers.

00526 {
00527   size_t i = 0;
00528 
00529   // Go through all the handles looking for <handle>.  Even if we find
00530   // it, we continue through the rest of the list since <handle> could
00531   // appear multiple times. All handles are checked.
00532 
00533   // Check the current entries first.
00534   for (i = 0; i < this->max_handlep1_; i++)
00535     // Since the handle can either be the event or the I/O handle,
00536     // we have to check both
00537     if ((this->current_handles_[i] == handle ||
00538          this->current_info_[i].io_handle_ == handle) &&
00539         // Make sure that the suspension is not already undone
00540         this->current_info_[i].suspend_entry_)
00541       {
00542         // Undo suspension
00543         this->current_info_[i].suspend_entry_ = 0;
00544         // Decrement the handle count
00545         this->handles_to_be_suspended_--;
00546         // Changes will be required
00547         changes_required = 1;
00548       }
00549 
00550   // Then check the suspended entries.
00551   for (i = 0; i < this->suspended_handles_; i++)
00552     // Since the handle can either be the event or the I/O handle,
00553     // we have to check both
00554     if ((this->current_suspended_info_[i].event_handle_ == handle ||
00555          this->current_suspended_info_[i].io_handle_ == handle) &&
00556         // Make sure that it is not already marked for resumption
00557         !this->current_suspended_info_[i].resume_entry_)
00558       {
00559         // Mark to be resumed
00560         this->current_suspended_info_[i].resume_entry_ = 1;
00561         // Increment the handle count
00562         this->handles_to_be_resumed_++;
00563         // Changes will be required
00564         changes_required = 1;
00565       }
00566 
00567   // Then check the to_be_added entries.
00568   for (i = 0; i < this->handles_to_be_added_; i++)
00569     // Since the handle can either be the event or the I/O handle,
00570     // we have to check both
00571     if ((this->to_be_added_info_[i].io_handle_ == handle ||
00572          this->to_be_added_info_[i].event_handle_ == handle) &&
00573         // Make sure that the suspension is not already undone
00574         this->to_be_added_info_[i].suspend_entry_)
00575       {
00576         // Undo suspension
00577         this->to_be_added_info_[i].suspend_entry_ = 0;
00578         // Decrement the handle count
00579         this->handles_to_be_suspended_--;
00580         // Changes will be required
00581         changes_required = 1;
00582       }
00583 
00584   return 0;
00585 }

ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion size_t    slot const
 

Check to see if <slot> has been scheduled for deletion.

Definition at line 358 of file WFMO_Reactor.i.

References current_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor::owner_i, ACE_Thread::self, and wfmo_reactor_.

Referenced by ACE_WFMO_Reactor::complex_dispatch_handler, and ACE_WFMO_Reactor::dispatch_handler.

00359 {
00360   if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
00361     return this->current_info_[slot].delete_entry_ == 1;
00362   else
00363     return this->current_info_[slot + 1].delete_entry_ == 1;
00364 }

int ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i ACE_HANDLE    handle,
int &    changes_required
 

Temporarily suspend entry.

Definition at line 460 of file WFMO_Reactor.cpp.

References changes_required, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, handles_to_be_added_, handles_to_be_resumed_, handles_to_be_suspended_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::resume_entry_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::suspend_entry_, ACE_WFMO_Reactor_Handler_Repository::Current_Info::suspend_entry_, suspended_handles_, and to_be_added_info_.

Referenced by ACE_WFMO_Reactor::suspend_handler, and ACE_WFMO_Reactor::suspend_handlers.

00462 {
00463   size_t i = 0;
00464 
00465   // Go through all the handles looking for <handle>.  Even if we find
00466   // it, we continue through the rest of the list since <handle> could
00467   // appear multiple times. All handles are checked.
00468 
00469   // Check the current entries first.
00470   for (i = 0; i < this->max_handlep1_; i++)
00471     // Since the handle can either be the event or the I/O handle,
00472     // we have to check both
00473     if ((this->current_handles_[i] == handle ||
00474          this->current_info_[i].io_handle_ == handle) &&
00475         // Make sure that it is not already marked for suspension
00476         !this->current_info_[i].suspend_entry_)
00477       {
00478         // Mark to be suspended
00479         this->current_info_[i].suspend_entry_ = 1;
00480         // Increment the handle count
00481         this->handles_to_be_suspended_++;
00482         // Changes will be required
00483         changes_required = 1;
00484       }
00485 
00486   // Then check the suspended entries.
00487   for (i = 0; i < this->suspended_handles_; i++)
00488     // Since the handle can either be the event or the I/O handle,
00489     // we have to check both
00490     if ((this->current_suspended_info_[i].event_handle_ == handle ||
00491          this->current_suspended_info_[i].io_handle_ == handle) &&
00492         // Make sure that the resumption is not already undone
00493         this->current_suspended_info_[i].resume_entry_)
00494       {
00495         // Undo resumption
00496         this->current_suspended_info_[i].resume_entry_ = 0;
00497         // Decrement the handle count
00498         this->handles_to_be_resumed_--;
00499         // Changes will be required
00500         changes_required = 1;
00501       }
00502 
00503   // Then check the to_be_added entries.
00504   for (i = 0; i < this->handles_to_be_added_; i++)
00505     // Since the handle can either be the event or the I/O handle,
00506     // we have to check both
00507     if ((this->to_be_added_info_[i].io_handle_ == handle ||
00508          this->to_be_added_info_[i].event_handle_ == handle) &&
00509         // Make sure that it is not already marked for suspension
00510         !this->to_be_added_info_[i].suspend_entry_)
00511       {
00512         // Mark to be suspended
00513         this->to_be_added_info_[i].suspend_entry_ = 1;
00514         // Increment the handle count
00515         this->handles_to_be_suspended_++;
00516         // Changes will be required
00517         changes_required = 1;
00518       }
00519 
00520   return 0;
00521 }

ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::unbind ACE_HANDLE   ,
ACE_Reactor_Mask    mask
 

Remove the binding of <ACE_HANDLE> in accordance with the <mask>.

Definition at line 413 of file WFMO_Reactor.i.

References ACE_GUARD_RETURN, ACE_Reactor_Mask, changes_required, invalid_handle, unbind_i, ACE_WFMO_Reactor::wakeup_all_threads, and wfmo_reactor_.

Referenced by ACE_WFMO_Reactor::complex_dispatch_handler, ACE_WFMO_Reactor::remove_handler, and ACE_WFMO_Reactor::simple_dispatch_handler.

00415 {
00416   if (this->invalid_handle (handle))
00417     return -1;
00418 
00419   ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1);
00420 
00421   int changes_required = 0;
00422   int result = this->unbind_i (handle,
00423                                mask,
00424                                changes_required);
00425 
00426   if (changes_required)
00427     // Wake up all threads in WaitForMultipleObjects so that they can
00428     // reconsult the handle set
00429     this->wfmo_reactor_.wakeup_all_threads ();
00430 
00431   return result;
00432 }

void ACE_WFMO_Reactor_Handler_Repository::unbind_all void   
 

Remove all bindings of <ACE_HANDLE, ACE_Event_Handler> tuples.

Definition at line 588 of file WFMO_Reactor.cpp.

References ACE_GUARD, ACE_Event_Handler::ALL_EVENTS_MASK, handles_to_be_added_, max_handlep1_, suspended_handles_, unbind_i, ACE_WFMO_Reactor::wakeup_all_threads, and wfmo_reactor_.

Referenced by close.

00589 {
00590   {
00591     ACE_GUARD (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_);
00592 
00593     int dummy;
00594     size_t i;
00595 
00596     // Remove all the current handlers
00597     for (i = 0; i < this->max_handlep1_; i++)
00598       this->unbind_i (this->current_handles_[i],
00599                       ACE_Event_Handler::ALL_EVENTS_MASK,
00600                       dummy);
00601 
00602     // Remove all the suspended handlers
00603     for (i = 0; i < this->suspended_handles_; i++)
00604       this->unbind_i (this->current_suspended_info_[i].event_handle_,
00605                       ACE_Event_Handler::ALL_EVENTS_MASK,
00606                       dummy);
00607 
00608     // Remove all the to_be_added handlers
00609     for (i = 0; i < this->handles_to_be_added_; i++)
00610       this->unbind_i (this->to_be_added_info_[i].event_handle_,
00611                       ACE_Event_Handler::ALL_EVENTS_MASK,
00612                       dummy);
00613 
00614   }
00615 
00616   // The guard is released here
00617 
00618   // Wake up all threads in WaitForMultipleObjects so that they can
00619   // reconsult the handle set
00620   this->wfmo_reactor_.wakeup_all_threads ();
00621 }

int ACE_WFMO_Reactor_Handler_Repository::unbind_i ACE_HANDLE   ,
ACE_Reactor_Mask    mask,
int &    changes_required
 

Non-lock-grabbing version of <unbind>.

Definition at line 186 of file WFMO_Reactor.cpp.

References ACE_Reactor_Mask, changes_required, current_handles_, current_info_, current_suspended_info_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::delete_entry_, ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::event_handle_, ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::event_handle_, handles_to_be_added_, handles_to_be_deleted_, ACE_WFMO_Reactor_Handler_Repository::Common_Info::io_handle_, max_handlep1_, remove_handler_i, remove_suspended_handler_i, remove_to_be_added_handler_i, suspended_handles_, and to_be_added_info_.

Referenced by ACE_WFMO_Reactor::remove_handler, unbind, and unbind_all.

00189 {
00190   int error = 0;
00191 
00192   // Remember this value; only if it changes do we need to wakeup
00193   // the other threads
00194   size_t original_handle_count = this->handles_to_be_deleted_;
00195   int result = 0;
00196   size_t i;
00197 
00198   // Go through all the handles looking for <handle>.  Even if we find
00199   // it, we continue through the rest of the list since <handle> could
00200   // appear multiple times. All handles are checked.
00201 
00202   // First check the current entries
00203   for (i = 0; i < this->max_handlep1_ && error == 0; i++)
00204     // Since the handle can either be the event or the I/O handle,
00205     // we have to check both
00206     if ((this->current_handles_[i] == handle
00207          || this->current_info_[i].io_handle_ == handle)
00208         && // Make sure that it is not already marked for deleted
00209         !this->current_info_[i].delete_entry_)
00210       {
00211         result = this->remove_handler_i (i,
00212                                          mask);
00213         if (result == -1)
00214           error = 1;
00215       }
00216 
00217   // Then check the suspended entries
00218   for (i = 0; i < this->suspended_handles_ && error == 0; i++)
00219     // Since the handle can either be the event or the I/O handle, we
00220     // have to check both
00221     if ((this->current_suspended_info_[i].io_handle_ == handle
00222          || this->current_suspended_info_[i].event_handle_ == handle)
00223         &&
00224         // Make sure that it is not already marked for deleted
00225         !this->current_suspended_info_[i].delete_entry_)
00226       {
00227         result = this->remove_suspended_handler_i (i,
00228                                                    mask);
00229         if (result == -1)
00230           error = 1;
00231       }
00232 
00233   // Then check the to_be_added entries
00234   for (i = 0; i < this->handles_to_be_added_ && error == 0; i++)
00235     // Since the handle can either be the event or the I/O handle,
00236     // we have to check both
00237     if ((this->to_be_added_info_[i].io_handle_ == handle
00238          || this->to_be_added_info_[i].event_handle_ == handle)
00239         &&
00240         // Make sure that it is not already marked for deleted
00241         !this->to_be_added_info_[i].delete_entry_)
00242       {
00243         result = this->remove_to_be_added_handler_i (i,
00244                                                      mask);
00245         if (result == -1)
00246           error = 1;
00247       }
00248 
00249   // Only if the number of handlers to be deleted changes do we need
00250   // to wakeup the other threads
00251   if (original_handle_count < this->handles_to_be_deleted_)
00252     changes_required = 1;
00253 
00254   return error ? -1 : 0;
00255 }


Friends And Related Function Documentation

friend class ACE_WFMO_Reactor [friend]
 

Definition at line 99 of file WFMO_Reactor.h.

friend class ACE_WFMO_Reactor_Test [friend]
 

Definition at line 100 of file WFMO_Reactor.h.


Member Data Documentation

ACE_HANDLE* ACE_WFMO_Reactor_Handler_Repository::current_handles_ [protected]
 

Array of <ACE_HANDLEs> passed to <WaitForMultipleObjects>. This is not part of the structure as the handle array needs to be passed directly to <WaitForMultipleObjects>.

Definition at line 429 of file WFMO_Reactor.h.

Referenced by handler, handles, make_changes_in_current_infos, make_changes_in_suspension_infos, make_changes_in_to_be_added_infos, modify_network_events_i, open, remove_handler_i, resume_handler_i, suspend_handler_i, unbind_i, and ~ACE_WFMO_Reactor_Handler_Repository.

Current_Info* ACE_WFMO_Reactor_Handler_Repository::current_info_ [protected]
 

Array of current entries in the table.

Definition at line 432 of file WFMO_Reactor.h.

Referenced by current_info, dump, handler, make_changes_in_current_infos, make_changes_in_suspension_infos, make_changes_in_to_be_added_infos, modify_network_events_i, remove_handler_i, resume_handler_i, scheduled_for_deletion, suspend_handler_i, unbind_i, and ~ACE_WFMO_Reactor_Handler_Repository.

Suspended_Info* ACE_WFMO_Reactor_Handler_Repository::current_suspended_info_ [protected]
 

Currently suspended handles.

Definition at line 444 of file WFMO_Reactor.h.

Referenced by dump, handler, make_changes_in_current_infos, make_changes_in_suspension_infos, make_changes_in_to_be_added_infos, modify_network_events_i, remove_suspended_handler_i, resume_handler_i, suspend_handler_i, unbind_i, and ~ACE_WFMO_Reactor_Handler_Repository.

size_t ACE_WFMO_Reactor_Handler_Repository::handles_to_be_added_ [protected]
 

Number of records to be added.

Definition at line 441 of file WFMO_Reactor.h.

Referenced by bind_i, changes_required, dump, handler, make_changes_in_to_be_added_infos, modify_network_events_i, open, resume_handler_i, ACE_WFMO_Reactor::resume_handlers, suspend_handler_i, ACE_WFMO_Reactor::suspend_handlers, unbind_all, and unbind_i.

size_t ACE_WFMO_Reactor_Handler_Repository::handles_to_be_deleted_ [protected]
 

Number of records to be deleted.

Definition at line 456 of file WFMO_Reactor.h.

Referenced by bind_i, changes_required, make_changes_in_current_infos, make_changes_in_suspension_infos, make_changes_in_to_be_added_infos, open, remove_handler_i, remove_suspended_handler_i, remove_to_be_added_handler_i, and unbind_i.

size_t ACE_WFMO_Reactor_Handler_Repository::handles_to_be_resumed_ [protected]
 

Number of records to be resumed.

Definition at line 453 of file WFMO_Reactor.h.

Referenced by changes_required, make_changes_in_suspension_infos, open, remove_suspended_handler_i, resume_handler_i, and suspend_handler_i.

size_t ACE_WFMO_Reactor_Handler_Repository::handles_to_be_suspended_ [protected]
 

Number of records to be suspended.

Definition at line 450 of file WFMO_Reactor.h.

Referenced by changes_required, make_changes_in_current_infos, make_changes_in_to_be_added_infos, open, remove_handler_i, remove_to_be_added_handler_i, resume_handler_i, and suspend_handler_i.

DWORD ACE_WFMO_Reactor_Handler_Repository::max_handlep1_ [protected]
 

A count of the number of active handles.

Definition at line 435 of file WFMO_Reactor.h.

Referenced by bind_i, dump, handler, make_changes_in_current_infos, make_changes_in_suspension_infos, make_changes_in_to_be_added_infos, max_handlep1, modify_network_events_i, open, resume_handler_i, suspend_handler_i, ACE_WFMO_Reactor::suspend_handlers, unbind_all, and unbind_i.

size_t ACE_WFMO_Reactor_Handler_Repository::max_size_ [protected]
 

Maximum number of handles.

Definition at line 422 of file WFMO_Reactor.h.

Referenced by bind_i, open, and ACE_WFMO_Reactor::size.

size_t ACE_WFMO_Reactor_Handler_Repository::suspended_handles_ [protected]
 

Number of currently suspended handles.

Definition at line 447 of file WFMO_Reactor.h.

Referenced by bind_i, dump, handler, make_changes_in_current_infos, make_changes_in_suspension_infos, make_changes_in_to_be_added_infos, modify_network_events_i, open, resume_handler_i, ACE_WFMO_Reactor::resume_handlers, suspend_handler_i, unbind_all, and unbind_i.

To_Be_Added_Info* ACE_WFMO_Reactor_Handler_Repository::to_be_added_info_ [protected]
 

Information for entries to be added.

Definition at line 438 of file WFMO_Reactor.h.

Referenced by bind_i, dump, handler, make_changes_in_to_be_added_infos, modify_network_events_i, remove_to_be_added_handler_i, resume_handler_i, ACE_WFMO_Reactor::resume_handlers, suspend_handler_i, ACE_WFMO_Reactor::suspend_handlers, unbind_i, and ~ACE_WFMO_Reactor_Handler_Repository.

ACE_WFMO_Reactor& ACE_WFMO_Reactor_Handler_Repository::wfmo_reactor_ [protected]
 

Reference to our <WFMO_Reactor>.

Definition at line 419 of file WFMO_Reactor.h.

Referenced by bind_i, current_info, handles, max_handlep1, scheduled_for_deletion, unbind, and unbind_all.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:59:14 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002