ost::ThreadQueue - Somewhat generic queue processing class to establish a producer consumer queue.
Contents
Constructor & Destructor Documentation
ost::ThreadQueue::ThreadQueue(constchar*id,intpri,size_tstack=0)
Create instance of our queue and give it a process priority.
Parametersid queue ID.
pri process priority.
stack stack size.
virtualost::ThreadQueue::~ThreadQueue()[virtual]
Destroy the queue.
Detailed Description
Somewhat generic queue processing class to establish a producer consumer queue.
This may be used to buffer cdr records, or for other purposes where an in-memory queue is needed for
rapid posting. This class is derived from Mutex and maintains a linked list. A thread is used to dequeue
data and pass it to a callback method that is used in place of 'run' for each item present on the queue.
The conditional is used to signal the run thread when new data is posted.
This class was changed by Angelo Naselli to have a timeout on the queue
in memory data queue interface.
Author
David Sugar dyfet@ostel.comMember Data Documentation
data_t*ost::ThreadQueue::first[protected]data_t*ost::ThreadQueue::last[protected]Stringost::ThreadQueue::name[protected]boolost::ThreadQueue::started[protected]timeout_tost::ThreadQueue::timeout[protected]
Member Function Documentation
virtualvoidost::ThreadQueue::final()[protected],[virtual]
Reimplemented from ost::Thread.
virtualvoidost::ThreadQueue::onTimer(void)[protected],[virtual]
A derivable method to call when the timout is expired.
voidost::ThreadQueue::post(constvoid*data,unsignedlen)
Put some unspecified data into this queue. A new qd structure is created and sized to contain a copy of
the actual content.
Parametersdata pointer to data.
len size of data.
virtualvoidost::ThreadQueue::runQueue(void*data)[protected],[purevirtual]
Virtual callback method to handle processing of a queued data items. After the item is processed, it is
deleted from memory. We can call multiple instances of runQueue in order if multiple items are waiting.
Parametersdata item being dequed.
voidost::ThreadQueue::setTimer(timeout_ttimeout)
Set the queue timeout. When the timer expires, the onTimer() method is called for the thread
Parameterstimeout timeout in milliseconds.
virtualvoidost::ThreadQueue::startQueue(void)[protected],[virtual]
Start of dequeing. Maybe we need to connect a database or something, so we have a virtual...
virtualvoidost::ThreadQueue::stopQueue(void)[protected],[virtual]
End of dequeing, we expect the queue is empty for now. Maybe we need to disconnect a database or
something, so we have another virtual.
Member Typedef Documentation
typedefstructost::ThreadQueue::_dataost::ThreadQueue::data_t[protected]
Name
ost::ThreadQueue - Somewhat generic queue processing class to establish a producer consumer queue.
Synopsis
#include <buffer.h>
Inherits ost::Mutex, ost::Thread, and ost::Semaphore.
Classes
struct _dataPublicMemberFunctionsThreadQueue (const char *id, int pri, size_t stack=0)
Create instance of our queue and give it a process priority.
virtual ~ThreadQueue ()
Destroy the queue.
void setTimer (timeout_ttimeout)
Set the queue timeout.
void post (const void *data, unsigned len)
Put some unspecified data into this queue.
ProtectedTypes
typedef struct ost::ThreadQueue::_datadata_tProtectedMemberFunctions
virtual void final ()
virtual void startQueue (void)
Start of dequeing.
virtual void stopQueue (void)
End of dequeing, we expect the queue is empty for now.
virtual void onTimer (void)
A derivable method to call when the timout is expired.
virtual void runQueue (void *data)=0
Virtual callback method to handle processing of a queued data items.
ProtectedAttributestimeout_ttimeout
bool starteddata_t * firstdata_t * lastStringnameAdditionalInheritedMembers