This structure contains information of the activated event handler.
#include <ace/TP_Reactor.h>
class ACE_EH_Dispatch_Info {
public:
ACE_EH_Dispatch_Info (void);
void set ( ACE_HANDLE handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, ACE_EH_PTMF callback );
void reset (void);
int dispatch (void) const;
ACE_HANDLE handle_;
ACE_Event_Handler *event_handler_;
ACE_Reactor_Mask mask_;
ACE_EH_PTMF callback_;
int dispatch_;
};
ACE_TP_Reactor
(aka, Thread Pool Reactor) uses the
Leader/Followers pattern to demultiplex events among a pool of
threads. When using a thread pool reactor, an application
pre-spawns a _fixed_ number of threads. When these threads
invoke the ACE_TP_Reactor
's handle_events
method, one thread
will become the leader and wait for an event. The other
follower threads will queue up waiting for their turn to become
the leader. When an event occurs, the leader will pick a
follower to become the leader and go on to handle the event.
The consequence of using ACE_TP_Reactor
is the amortization of
the costs used to creating threads. The context switching cost
will also reduce. More over, the total resources used by
threads are bounded because there are a fixed number of threads.
ACE_EH_Dispatch_Info (void);
void set (
ACE_HANDLE handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask,
ACE_EH_PTMF callback
);
void reset (void);
int dispatch (void) const;
ACE_HANDLE handle_;
ACE_Event_Handler *event_handler_;
ACE_Reactor_Mask mask_;
ACE_EH_PTMF callback_;
int dispatch_;
irfan@cs.wustl.edu
and Nanbor Wang nanbor@cs.wustl.edu