ACE 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ACE_Notification_Queue Class Reference

Implements a user-space queue to send Reactor notifications. More...

#include <Notification_Queue.h>

Collaboration diagram for ACE_Notification_Queue:
Collaboration graph
[legend]

Public Member Functions

 ACE_Notification_Queue ()
 
 ~ACE_Notification_Queue ()
 
int open ()
 Pre-allocate resources in the queue.
 
void reset ()
 Release all resources in the queue.
 
int purge_pending_notifications (ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
 Remove all elements in the queue matching eh and mask.
 
int push_new_notification (ACE_Notification_Buffer const &buffer)
 Add a new notification to the queue.
 
int pop_next_notification (ACE_Notification_Buffer &current, bool &more_messages_queued, ACE_Notification_Buffer &next)
 Extract the next notification from the queue.
 

Private Types

typedef ACE_Intrusive_List< ACE_Notification_Queue_NodeBuffer_List
 

Private Member Functions

int allocate_more_buffers ()
 Allocate more memory for the queue.
 
 ACE_Notification_Queue (const ACE_Notification_Queue &)=delete
 
 ACE_Notification_Queue (ACE_Notification_Queue &&)=delete
 
ACE_Notification_Queueoperator= (const ACE_Notification_Queue &)=delete
 
ACE_Notification_Queueoperator= (ACE_Notification_Queue &&)=delete
 

Private Attributes

ACE_Unbounded_Queue< ACE_Notification_Queue_Node * > alloc_queue_
 
Buffer_List notify_queue_
 Keeps track of all pending notifications.
 
Buffer_List free_queue_
 Keeps track of all free buffers.
 
ACE_SYNCH_MUTEX notify_queue_lock_
 Synchronization for handling of queues.
 

Detailed Description

Implements a user-space queue to send Reactor notifications.

The ACE_Reactor uses a pipe to send wake up the thread running the event loop from other threads. This pipe can be limited in size under some operating systems. For some applications, this limit presents a problem. A user-space notification queue is used to overcome those limitations. The queue tries to use as few resources on the pipe as possible, while keeping all the data in user space.

This code was refactored from Select_Reactor_Base.

Member Typedef Documentation

◆ Buffer_List

Constructor & Destructor Documentation

◆ ACE_Notification_Queue() [1/3]

ACE_Notification_Queue::ACE_Notification_Queue ( )

◆ ~ACE_Notification_Queue()

ACE_Notification_Queue::~ACE_Notification_Queue ( )

◆ ACE_Notification_Queue() [2/3]

ACE_Notification_Queue::ACE_Notification_Queue ( const ACE_Notification_Queue & )
privatedelete

◆ ACE_Notification_Queue() [3/3]

ACE_Notification_Queue::ACE_Notification_Queue ( ACE_Notification_Queue && )
privatedelete

Member Function Documentation

◆ allocate_more_buffers()

int ACE_Notification_Queue::allocate_more_buffers ( )
private

Allocate more memory for the queue.

◆ open()

int ACE_Notification_Queue::open ( )

Pre-allocate resources in the queue.

◆ operator=() [1/2]

ACE_Notification_Queue & ACE_Notification_Queue::operator= ( ACE_Notification_Queue && )
privatedelete

◆ operator=() [2/2]

ACE_Notification_Queue & ACE_Notification_Queue::operator= ( const ACE_Notification_Queue & )
privatedelete

◆ pop_next_notification()

int ACE_Notification_Queue::pop_next_notification ( ACE_Notification_Buffer & current,
bool & more_messages_queued,
ACE_Notification_Buffer & next )

Extract the next notification from the queue.

Returns
-1 on failure, 1 if a message was popped, 0 otherwise

◆ purge_pending_notifications()

int ACE_Notification_Queue::purge_pending_notifications ( ACE_Event_Handler * eh,
ACE_Reactor_Mask mask )

Remove all elements in the queue matching eh and mask.

I suggest reading the documentation in ACE_Reactor to find a more detailed description. This is just a helper function.

◆ push_new_notification()

int ACE_Notification_Queue::push_new_notification ( ACE_Notification_Buffer const & buffer)

Add a new notification to the queue.

Returns
-1 on failure, 1 if a new message should be sent through the pipe and 0 otherwise.

◆ reset()

void ACE_Notification_Queue::reset ( )

Release all resources in the queue.

Member Data Documentation

◆ alloc_queue_

ACE_Unbounded_Queue<ACE_Notification_Queue_Node*> ACE_Notification_Queue::alloc_queue_
private

Keeps track of allocated arrays of type ACE_Notification_Buffer. The idea is to amortize allocation costs by allocating multiple ACE_Notification_Buffer objects at a time.

◆ free_queue_

Buffer_List ACE_Notification_Queue::free_queue_
private

Keeps track of all free buffers.

◆ notify_queue_

Buffer_List ACE_Notification_Queue::notify_queue_
private

Keeps track of all pending notifications.

◆ notify_queue_lock_

ACE_SYNCH_MUTEX ACE_Notification_Queue::notify_queue_lock_
private

Synchronization for handling of queues.


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