ACE_Select_Reactor
from its event loop.
#include <ace/Select_Reactor.h>
class ACE_Select_Reactor_Notify : public ACE_Event_Handler {
public:
int open (ACE_Select_Reactor *);
int close (void);
int dispatch_notifications ( int &number_of_active_handles, const ACE_Handle_Set &rd_mask );
ssize_t notify ( ACE_Event_Handler * = 0, ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value * = 0 );
virtual int handle_input (ACE_HANDLE handle);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
ACE_Select_Reactor *select_reactor_;
ACE_Pipe notification_pipe_;
};
ACE_Select_Reactor
is run in a multi-threaded program. In
this case, we need to be able to unblock select() or poll()
when updates occur other than in the main
ACE_Select_Reactor
thread. To do this, we signal an
auto-reset event the ACE_Select_Reactor
is listening on.
If an ACE_Event_Handler
and ACE_Select_Reactor_Mask
is
passed to notify
, the appropriate handle_*
method is
dispatched in the context of the ACE_Select_Reactor
thread.
int open (ACE_Select_Reactor *);
int close (void);
int dispatch_notifications (
int &number_of_active_handles,
const ACE_Handle_Set &rd_mask
);
ssize_t notify (
ACE_Event_Handler * = 0,
ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * = 0
);
ACE_Select_Reactor
if currently blocked in
select()/poll(). Pass over both the Event_Handler
*and* the
mask
to allow the caller to dictate which Event_Handler
method the Select_Reactor
will invoke. The ACE_Time_Value
indicates how long to blocking trying to notify the
Select_Reactor
. If timeout
== 0, the caller will block until
action is possible, else will wait until the relative time
specified in *timeout
elapses).
virtual int handle_input (ACE_HANDLE handle);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;