ACE 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
ACE_Select_Reactor_Notify Class Reference

Unblock the ACE_Select_Reactor from its event loop. More...

#include <Select_Reactor_Base.h>

Inheritance diagram for ACE_Select_Reactor_Notify:
Inheritance graph
[legend]
Collaboration diagram for ACE_Select_Reactor_Notify:
Collaboration graph
[legend]

Public Member Functions

 ACE_Select_Reactor_Notify ()
 Constructor.
 
virtual ~ACE_Select_Reactor_Notify ()
 Destructor.
 
virtual int open (ACE_Reactor_Impl *, ACE_Timer_Queue *=0, int disable_notify_pipe=ACE_DISABLE_NOTIFY_PIPE_DEFAULT)
 Initialize.
 
virtual int close ()
 Destroy.
 
virtual int notify (ACE_Event_Handler *=0, ACE_Reactor_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)
 
virtual ACE_HANDLE notify_handle ()
 
virtual int dispatch_notify (ACE_Notification_Buffer &buffer)
 
virtual int read_notify_pipe (ACE_HANDLE handle, ACE_Notification_Buffer &buffer)
 
virtual int is_dispatchable (ACE_Notification_Buffer &buffer)
 Verify whether the buffer has dispatchable info or not.
 
virtual int handle_input (ACE_HANDLE handle)
 
virtual void max_notify_iterations (int)
 
virtual int max_notify_iterations ()
 
virtual int purge_pending_notifications (ACE_Event_Handler *sh, ACE_Reactor_Mask mask=ACE_Event_Handler::ALL_EVENTS_MASK)
 
virtual void dump () const
 Dump the state of an object.
 
- Public Member Functions inherited from ACE_Event_Handler
virtual ~ACE_Event_Handler ()=default
 Destructor is virtual to enable proper cleanup.
 
virtual ACE_HANDLE get_handle () const
 Get the I/O handle.
 
virtual void set_handle (ACE_HANDLE)
 Set the I/O handle.
 
virtual int priority () const
 
virtual void priority (int priority)
 Set the priority of the Event_Handler.
 
virtual int handle_output (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 
virtual int handle_exception (ACE_HANDLE fd=ACE_INVALID_HANDLE)
 Called when an exceptional events occur (e.g., SIGURG).
 
virtual int handle_timeout (const ACE_Time_Value &current_time, const void *act=0)
 
virtual int handle_exit (ACE_Process *)
 Called when a process exits.
 
virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask)
 
virtual int handle_signal (int signum, siginfo_t *=0, ucontext_t *=0)
 
virtual int resume_handler ()
 
virtual int handle_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
 
virtual int handle_group_qos (ACE_HANDLE=ACE_INVALID_HANDLE)
 
virtual void reactor (ACE_Reactor *reactor)
 Set the event demultiplexors.
 
virtual ACE_Reactorreactor () const
 Get the event demultiplexors.
 
virtual ACE_Reactor_Timer_Interfacereactor_timer_interface () const
 Get only the reactor's timer related interface.
 
virtual Reference_Count add_reference ()
 Increment reference count on the handler.
 
virtual Reference_Count remove_reference ()
 Decrement reference count on the handler.
 
Reference_Counting_Policyreference_counting_policy ()
 Current Reference_Counting_Policy.
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
 

Protected Attributes

ACE_Select_Reactor_Implselect_reactor_
 
ACE_Pipe notification_pipe_
 
int max_notify_iterations_
 
- Protected Attributes inherited from ACE_Event_Handler
Atomic_Reference_Count reference_count_
 Reference count.
 

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 std::atomic< Reference_CountAtomic_Reference_Count
 Typedef for implementation of reference counting.
 
- Protected Member Functions inherited from ACE_Event_Handler
 ACE_Event_Handler (ACE_Reactor *=nullptr, int priority=ACE_Event_Handler::LO_PRIORITY)
 Force ACE_Event_Handler to be an abstract base class.
 

Detailed Description

Unblock the ACE_Select_Reactor from its event loop.

This implementation is necessary for cases where the 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.

Constructor & Destructor Documentation

◆ ACE_Select_Reactor_Notify()

ACE_Select_Reactor_Notify::ACE_Select_Reactor_Notify ( )

Constructor.

◆ ~ACE_Select_Reactor_Notify()

ACE_Select_Reactor_Notify::~ACE_Select_Reactor_Notify ( )
virtual

Destructor.

Member Function Documentation

◆ close()

int ACE_Select_Reactor_Notify::close ( )
virtual

Destroy.

Implements ACE_Reactor_Notify.

◆ dispatch_notifications()

int ACE_Select_Reactor_Notify::dispatch_notifications ( int & number_of_active_handles,
ACE_Handle_Set & rd_mask )
virtual

Handles pending threads (if any) that are waiting to unblock the ACE_Select_Reactor.

Implements ACE_Reactor_Notify.

◆ dispatch_notify()

int ACE_Select_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.

◆ dump()

void ACE_Select_Reactor_Notify::dump ( ) const
virtual

Dump the state of an object.

Implements ACE_Reactor_Notify.

◆ handle_input()

int ACE_Select_Reactor_Notify::handle_input ( ACE_HANDLE handle)
virtual

Called back by the ACE_Select_Reactor when a thread wants to unblock us.

Reimplemented from ACE_Event_Handler.

◆ is_dispatchable()

int ACE_Select_Reactor_Notify::is_dispatchable ( ACE_Notification_Buffer & buffer)
virtual

Verify whether the buffer has dispatchable info or not.

Implements ACE_Reactor_Notify.

◆ max_notify_iterations() [1/2]

int ACE_Select_Reactor_Notify::max_notify_iterations ( )
virtual

Get the maximum number of times that the ACE_Select_Reactor_Notify::handle_input() method will iterate and dispatch the ACE_Event_Handlers that are passed in via the notify pipe before breaking out of its recv loop.

Implements ACE_Reactor_Notify.

◆ max_notify_iterations() [2/2]

void ACE_Select_Reactor_Notify::max_notify_iterations ( int iterations)
virtual

Set the maximum number of times that the ACE_Select_Reactor_Notify::handle_input() method will iterate and dispatch the ACE_Event_Handlers that are passed in via the notify pipe before breaking out of its recv loop. By default, this is set to -1, which means "iterate until the pipe 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.

◆ notify()

int ACE_Select_Reactor_Notify::notify ( ACE_Event_Handler * event_handler = 0,
ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK,
ACE_Time_Value * timeout = 0 )
virtual

Called by a thread when it wants to unblock the ACE_Select_Reactor. This wakeups the 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 ACE_Select_Reactor will invoke. The ACE_Time_Value indicates how long to blocking trying to notify the ACE_Select_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.

◆ notify_handle()

ACE_HANDLE ACE_Select_Reactor_Notify::notify_handle ( )
virtual

Returns the ACE_HANDLE of the notify pipe on which the reactor is listening for notifications so that other threads can unblock the Select_Reactor

Implements ACE_Reactor_Notify.

◆ open()

int ACE_Select_Reactor_Notify::open ( ACE_Reactor_Impl * r,
ACE_Timer_Queue * = 0,
int disable_notify_pipe = ACE_DISABLE_NOTIFY_PIPE_DEFAULT )
virtual

Initialize.

Implements ACE_Reactor_Notify.

◆ purge_pending_notifications()

int ACE_Select_Reactor_Notify::purge_pending_notifications ( ACE_Event_Handler * sh,
ACE_Reactor_Mask 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.

◆ read_notify_pipe()

int ACE_Select_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

Return value semantics for this are: -1: nothing read, fatal, unrecoverable error 0: nothing read at all 1: complete buffer read

Implements ACE_Reactor_Notify.

Member Data Documentation

◆ ACE_ALLOC_HOOK_DECLARE

ACE_Select_Reactor_Notify::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

◆ max_notify_iterations_

int ACE_Select_Reactor_Notify::max_notify_iterations_
protected

Keeps track of the maximum number of times that the ACE_Select_Reactor_Notify::handle_input() method will iterate and dispatch the ACE_Event_Handlers that are passed in via the notify pipe before breaking out of its recv loop. By default, this is set to -1, which means "iterate until the pipe is empty."

◆ notification_pipe_

ACE_Pipe ACE_Select_Reactor_Notify::notification_pipe_
protected

Contains the ACE_HANDLE the ACE_Select_Reactor is listening on, as well as the ACE_HANDLE that threads wanting the attention of the ACE_Select_Reactor will write to.

◆ select_reactor_

ACE_Select_Reactor_Impl* ACE_Select_Reactor_Notify::select_reactor_
protected

Keep a back pointer to the ACE_Select_Reactor. If this value if NULL then the ACE_Select_Reactor has been initialized with disable_notify_pipe.


The documentation for this class was generated from the following files: