ACE
6.1.4
|
Unblock the <ACE_WFMO_Reactor> from its event loop, passing it an optional ACE_Event_Handler to dispatch. More...
#include <WFMO_Reactor.h>
Public Member Functions | |
ACE_WFMO_Reactor_Notify (size_t max_notifies=1024) | |
Constructor. | |
virtual int | open (ACE_Reactor_Impl *wfmo_reactor, ACE_Timer_Queue *timer_queue, int disable_notify=0) |
Initialization. <timer_queue> is stored to call <gettimeofday>. | |
virtual int | close (void) |
No-op. | |
virtual int | notify (ACE_Event_Handler *event_handler=0, ACE_Reactor_Mask mask=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *timeout=0) |
virtual int | dispatch_notifications (int &number_of_active_handles, ACE_Handle_Set &rd_mask) |
No-op. | |
virtual ACE_HANDLE | get_handle (void) const |
Returns a handle to the <ACE_Auto_Event>. | |
virtual ACE_HANDLE | notify_handle (void) |
virtual int | dispatch_notify (ACE_Notification_Buffer &buffer) |
virtual int | is_dispatchable (ACE_Notification_Buffer &buffer) |
Verify whether the buffer has dispatchable info or not. | |
virtual int | read_notify_pipe (ACE_HANDLE handle, ACE_Notification_Buffer &buffer) |
void | max_notify_iterations (int) |
int | max_notify_iterations (void) |
virtual int | purge_pending_notifications (ACE_Event_Handler *, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK) |
virtual void | dump (void) const |
Dump the state of an object. | |
Private Member Functions | |
virtual int | handle_signal (int signum, siginfo_t *=0, ucontext_t *=0) |
Private Attributes | |
ACE_Timer_Queue * | timer_queue_ |
Pointer to the wfmo_reactor's timer queue. | |
ACE_Auto_Event | wakeup_one_thread_ |
ACE_Message_Queue< ACE_MT_SYNCH > | message_queue_ |
int | max_notify_iterations_ |
Additional Inherited Members | |
Public Types inherited from ACE_Event_Handler | |
enum | { LO_PRIORITY = 0, HI_PRIORITY = 10, NULL_MASK = 0, READ_MASK = (1 << 0), WRITE_MASK = (1 << 1), EXCEPT_MASK = (1 << 2), ACCEPT_MASK = (1 << 3), CONNECT_MASK = (1 << 4), TIMER_MASK = (1 << 5), QOS_MASK = (1 << 6), GROUP_QOS_MASK = (1 << 7), SIGNAL_MASK = (1 << 8), ALL_EVENTS_MASK, RWE_MASK, DONT_CALL = (1 << 9) } |
enum | { ACE_EVENT_HANDLER_NOT_RESUMED = -1, ACE_REACTOR_RESUMES_HANDLER = 0, ACE_APPLICATION_RESUMES_HANDLER } |
typedef long | Reference_Count |
Reference count type. | |
Static Public Member Functions inherited from ACE_Event_Handler | |
static ACE_THR_FUNC_RETURN | read_adapter (void *event_handler) |
static int | register_stdin_handler (ACE_Event_Handler *eh, ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr, int flags=THR_DETACHED) |
static int | remove_stdin_handler (ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr) |
Performs the inverse of the register_stdin_handler() method. | |
Protected Types inherited from ACE_Event_Handler | |
typedef ACE_Atomic_Op < ACE_SYNCH_MUTEX, Reference_Count > | Atomic_Reference_Count |
Typedef for implementation of reference counting. | |
Protected Member Functions inherited from ACE_Event_Handler | |
ACE_Event_Handler (ACE_Reactor *=0, int priority=ACE_Event_Handler::LO_PRIORITY) | |
Force ACE_Event_Handler to be an abstract base class. | |
Protected Attributes inherited from ACE_Event_Handler | |
Atomic_Reference_Count | reference_count_ |
Reference count. | |
Unblock the <ACE_WFMO_Reactor> from its event loop, passing it an optional ACE_Event_Handler to dispatch.
This implementation is necessary for cases where the <ACE_WFMO_Reactor> is run in a multi-threaded program. In this case, we need to be able to unblock <WaitForMultipleObjects> when updates occur other than in the main <ACE_WFMO_Reactor> thread. To do this, we signal an auto-reset event the <ACE_WFMO_Reactor> is listening on. If an ACE_Event_Handler and ACE_Reactor_Mask is passed to <notify>, the appropriate <handle_*> method is dispatched.
ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify | ( | size_t | max_notifies = 1024 | ) |
Constructor.
|
virtual |
No-op.
Implements ACE_Reactor_Notify.
|
virtual |
No-op.
Implements ACE_Reactor_Notify.
|
virtual |
Handle one of the notify call on the <handle>. This could be because of a thread trying to unblock the <Reactor_Impl>
Implements ACE_Reactor_Notify.
|
virtual |
Dump the state of an object.
Implements ACE_Reactor_Notify.
|
virtual |
Returns a handle to the <ACE_Auto_Event>.
Reimplemented from ACE_Event_Handler.
|
privatevirtual |
Called when the notification event waited on by <ACE_WFMO_Reactor> is signaled. This dequeues all pending ACE_Event_Handlers and dispatches them.
Reimplemented from ACE_Event_Handler.
|
virtual |
Verify whether the buffer has dispatchable info or not.
Implements ACE_Reactor_Notify.
|
virtual |
Set the maximum number of times that the <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and dispatch the ACE_Event_Handlers that are passed in via the notify queue before breaking out of its <ACE_Message_Queue::dequeue> loop. By default, this is set to -1, which means "iterate until the queue is empty." Setting this to a value like "1 or 2" will increase "fairness" (and thus prevent starvation) at the expense of slightly higher dispatching overhead.
Implements ACE_Reactor_Notify.
|
virtual |
Get the maximum number of times that the ACE_WFMO_Reactor_Notify::handle_input() method will iterate and dispatch the ACE_Event_Handlers that are passed in via the notify queue before breaking out of its <ACE_Message_Queue::dequeue> loop.
Implements ACE_Reactor_Notify.
|
virtual |
Special trick to unblock <WaitForMultipleObjects> when updates occur. All we do is enqueue event_handler and mask onto the ACE_Message_Queue and wakeup the <WFMO_Reactor> by signaling its <ACE_Event> handle. The ACE_Time_Value indicates how long to blocking trying to notify the <WFMO_Reactor>. If timeout == 0, the caller will block until action is possible, else will wait until the relative time specified in timeout elapses).
Implements ACE_Reactor_Notify.
|
virtual |
Returns the ACE_HANDLE of the notify pipe on which the reactor is listening for notifications so that other threads can unblock the <Reactor_Impl>
Implements ACE_Reactor_Notify.
|
virtual |
Initialization. <timer_queue> is stored to call <gettimeofday>.
Implements ACE_Reactor_Notify.
|
virtual |
Purge any notifications pending in this reactor for the specified ACE_Event_Handler object. If eh == 0, all notifications for all handlers are removed (but not any notifications posted just to wake up the reactor itself). Returns the number of notifications purged. Returns -1 on error.
Implements ACE_Reactor_Notify.
|
virtual |
Read one of the notify call on the handle into the <buffer>. This could be because of a thread trying to unblock the <Reactor_Impl>
Implements ACE_Reactor_Notify.
|
private |
Keeps track of the maximum number of times that the <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and dispatch the ACE_Event_Handlers that are passed in via the notify queue before breaking out of its <ACE_Message_Queue::dequeue> loop. By default, this is set to -1, which means "iterate until the queue is empty."
|
private |
Message queue that keeps track of pending ACE_Event_Handlers. This queue must be thread-safe because it can be called by multiple threads of control.
|
private |
Pointer to the wfmo_reactor's timer queue.
|
private |
An auto event is used so that we can signal() it to wakeup one thread up (e.g., when the <notify> method is called).