Resource Tuner
|
This class represents a mutex-protected multiple producer, single consumer priority queue. More...
#include <OrderedQueue.h>
Public Member Functions | |
int8_t | addAndWakeup (Message *req) |
Used by the producers to add a new request to the OrderedQueue. | |
virtual void | orderedQueueConsumerHook ()=0 |
Provides a mechanism, to hook or plug-in the Consumer Code. | |
Message * | pop () |
Used by the consumer end to poll a request from the OrderedQueue. | |
void | wait () |
Used by the Consumer end to wait for Requests. | |
int8_t | hasPendingTasks () |
Used by the consumer to check if there are any pending requests in the OrderedQueue. | |
Protected Attributes | |
std::priority_queue< Message *, std::vector< Message * >, QueueOrdering > | mOrderedQueue |
Core OrderedQueue Data Structure, to store the Requests pushed by the Publisher threads. Makes use of std::priority_queue, which is ordered here based on the Request Priorities. | |
This class represents a mutex-protected multiple producer, single consumer priority queue.
The Queue items are ordered by their Priority, so that the Queue Item with the highest Priority is always served first.
Definition at line 22 of file OrderedQueue.h.
int8_t OrderedQueue::addAndWakeup | ( | Message * | req | ) |
Used by the producers to add a new request to the OrderedQueue.
This routine will wake up the consumer end to process the task.
req | Pointer to the Request |
int8_t OrderedQueue::hasPendingTasks | ( | ) |
Used by the consumer to check if there are any pending requests in the OrderedQueue.
|
pure virtual |
Provides a mechanism, to hook or plug-in the Consumer Code.
Using this routine, the consumer can safely (lock-protected) extract and process Requests enqueued by the Producers.
Implemented in RequestQueue, and SignalQueue.
Message * OrderedQueue::pop | ( | ) |
Used by the consumer end to poll a request from the OrderedQueue.
This routine will return the Request with the highest priority to the consumer and remove it from the OrderedQueue. If the OrderedQueue is empty this function returns a null pointer.
void OrderedQueue::wait | ( | ) |
Used by the Consumer end to wait for Requests.
This routine will put the consumer to sleep.