Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ACE_WFMO_Reactor_Notify Class Reference

Unblock the <ace_wfmo_reactor> from its event loop, passing it an optional <ace_event_handler> to dispatch. More...

#include <WFMO_Reactor.h>

Inheritance diagram for ACE_WFMO_Reactor_Notify:

Inheritance graph
[legend]
Collaboration diagram for ACE_WFMO_Reactor_Notify:

Collaboration graph
[legend]
List of all members.

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_Queuetimer_queue_
 Pointer to the wfmo_reactor's timer queue.
ACE_Auto_Event wakeup_one_thread_
ACE_Message_Queue< ACE_MT_SYNCHmessage_queue_
int max_notify_iterations_

Detailed Description

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.


Constructor & Destructor Documentation

ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify size_t  max_notifies = 1024  ) 
 

Constructor.


Member Function Documentation

int ACE_WFMO_Reactor_Notify::close void   )  [virtual]
 

No-op.

Implements ACE_Reactor_Notify.

int ACE_WFMO_Reactor_Notify::dispatch_notifications int &  number_of_active_handles,
ACE_Handle_Set rd_mask
[virtual]
 

No-op.

Implements ACE_Reactor_Notify.

int ACE_WFMO_Reactor_Notify::dispatch_notify ACE_Notification_Buffer buffer  )  [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.

void ACE_WFMO_Reactor_Notify::dump void   )  const [virtual]
 

Dump the state of an object.

Implements ACE_Reactor_Notify.

ACE_HANDLE ACE_WFMO_Reactor_Notify::get_handle void   )  const [virtual]
 

Returns a handle to the <ace_auto_event>.

Reimplemented from ACE_Event_Handler.

int ACE_WFMO_Reactor_Notify::handle_signal int  signum,
siginfo_t = 0,
ucontext_t = 0
[private, virtual]
 

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.

int ACE_WFMO_Reactor_Notify::is_dispatchable ACE_Notification_Buffer buffer  )  [virtual]
 

Verify whether the buffer has dispatchable info or not.

Implements ACE_Reactor_Notify.

int ACE_WFMO_Reactor_Notify::max_notify_iterations void   )  [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.

void ACE_WFMO_Reactor_Notify::max_notify_iterations int   )  [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.

int ACE_WFMO_Reactor_Notify::notify ACE_Event_Handler event_handler = 0,
ACE_Reactor_Mask  mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value timeout = 0
[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.

ACE_HANDLE ACE_WFMO_Reactor_Notify::notify_handle void   )  [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.

int ACE_WFMO_Reactor_Notify::open ACE_Reactor_Impl wfmo_reactor,
ACE_Timer_Queue timer_queue,
int  disable_notify = 0
[virtual]
 

Initialization. <timer_queue> is stored to call <gettimeofday>.

Implements ACE_Reactor_Notify.

int ACE_WFMO_Reactor_Notify::purge_pending_notifications ACE_Event_Handler ,
ACE_Reactor_Mask  = ACE_Event_Handler::ALL_EVENTS_MASK
[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.

int ACE_WFMO_Reactor_Notify::read_notify_pipe ACE_HANDLE  handle,
ACE_Notification_Buffer buffer
[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.


Member Data Documentation

int ACE_WFMO_Reactor_Notify::max_notify_iterations_ [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."

ACE_Message_Queue<ACE_MT_SYNCH> ACE_WFMO_Reactor_Notify::message_queue_ [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.

ACE_Timer_Queue* ACE_WFMO_Reactor_Notify::timer_queue_ [private]
 

Pointer to the wfmo_reactor's timer queue.

ACE_Auto_Event ACE_WFMO_Reactor_Notify::wakeup_one_thread_ [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).


The documentation for this class was generated from the following files:
Generated on Sun May 15 12:51:55 2005 for ACE by  doxygen 1.3.9.1