Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::NotificationQueue Class Reference

#include <NotificationQueue.h>

List of all members.

Detailed Description

A NotificationQueue object provides a way to implement asynchronous notifications. This is especially useful for sending notifications from one thread to another, for example from a background thread to the main (user interface) thread.

The NotificationQueue can also be used to distribute work from a controlling thread to one or more worker threads. Each worker thread repeatedly calls waitDequeueNotification() and processes the returned notification. Special care must be taken when shutting down a queue with worker threads waiting for notifications. The recommended sequence to shut down and destroy the queue is to 1. set a termination flag for every worker thread 2. call the wakeUpAll() method 3. join each worker thread 4. destroy the notification queue.

Definition at line 56 of file NotificationQueue.h.

Public Member Functions

void clear ()
 Returns the number of notifications in the queue.
NotificationdequeueNotification ()
void dispatch (NotificationCenter &notificationCenter)
bool empty () const
 Wakes up all threads that wait for a notification.
void enqueueNotification (Notification *pNotification)
 Destroys the NotificationQueue.
void enqueueUrgentNotification (Notification *pNotification)
bool hasIdleThreads () const
 Removes all notifications from the queue.
int size () const
 Returns true iff the queue is empty.
NotificationwaitDequeueNotification (long milliseconds)
NotificationwaitDequeueNotification ()
void wakeUpAll ()
 ~NotificationQueue ()
 Creates the NotificationQueue.

Static Public Member Functions

static NotificationQueuedefaultQueue ()

Protected Member Functions

NotificationdequeueOne ()

Private Types

typedef std::deque
< Notification * > 
typedef std::deque< WaitInfo * > WaitQueue

Private Attributes

FastMutex _mutex
NfQueue _nfQueue
WaitQueue _waitQueue


struct  WaitInfo

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

Generated by  Doxygen 1.6.0   Back to index