ACE_Reactor
from its event loop.
#include <ace/Reactor.h>
class ACE_Reactor_Notify : public ACE_Event_Handler {
public:
int open (ACE_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_Reactor *reactor_;
ACE_Pipe notification_pipe_;
};
ACE_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_Reactor
thread.
To do this, we signal an auto-reset event the ACE_Reactor
is listening on. If an ACE_Event_Handler
and
ACE_Reactor_Mask
is passed to notify
, the appropriate
handle_*
method is dispatched in the context of the
ACE_Reactor
thread.
int open (ACE_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_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 Reactor
will invoke. The ACE_Time_Value
indicates
how long to blocking trying to notify the 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;