|
reSIProcate/rutil
9694
|
A templated, threadsafe message-queue class. More...
#include <Fifo.hxx>


Public Types | |
| typedef AbstractFifo< Msg * > ::Messages | Messages |
Public Member Functions | |
| Fifo (AsyncProcessHandler *interruptor=0) | |
| virtual | ~Fifo () |
| size_t | add (Msg *msg) |
| Add a message to the fifo. | |
| size_t | addMultiple (Messages &msgs) |
| Msg * | getNext () |
| Returns the first message available. | |
| Msg * | getNext (int ms) |
| Returns the next message available. | |
| void | getMultiple (Messages &other, unsigned int max) |
| bool | getMultiple (int ms, Messages &other, unsigned int max) |
| virtual void | clear () |
| delete all elements in the queue | |
| void | setInterruptor (AsyncProcessHandler *interruptor) |
Private Member Functions | |
| Fifo (const Fifo &rhs) | |
| Fifo & | operator= (const Fifo &rhs) |
Private Attributes | |
| AsyncProcessHandler * | mInterruptor |
A templated, threadsafe message-queue class.
| typedef AbstractFifo<Msg*>::Messages resip::Fifo< Msg >::Messages |
Reimplemented from resip::AbstractFifo< Msg * >.
| resip::Fifo< Msg >::Fifo | ( | AsyncProcessHandler * | interruptor = 0 | ) |
Definition at line 66 of file Fifo.hxx.
: AbstractFifo<Msg*>(), mInterruptor(interruptor) { }
| resip::Fifo< Msg >::~Fifo | ( | ) | [virtual] |
| resip::Fifo< Msg >::Fifo | ( | const Fifo< Msg > & | rhs | ) | [private] |
| size_t resip::Fifo< Msg >::add | ( | Msg * | msg | ) |
Add a message to the fifo.
Definition at line 102 of file Fifo.hxx.
References resip::AbstractFifo< T >::add().
Referenced by resip::DnsStub::clearDnsCache(), resip::DnsStub::getDnsCacheDump(), resip::DnsStub::logDnsCache(), resip::DnsStub::lookup(), and resip::DnsStub::setEnumSuffixes().
{
size_t size = AbstractFifo<Msg*>::add(msg);
if(size==1 && mInterruptor)
{
// Only do this when the queue goes from empty to not empty.
mInterruptor->handleProcessNotification();
}
return size;
}

| size_t resip::Fifo< Msg >::addMultiple | ( | Messages & | msgs | ) |
Definition at line 115 of file Fifo.hxx.
References resip::AbstractFifo< T >::addMultiple().
Referenced by resip::ProducerFifoBuffer< T >::flush().
{
size_t inSize = msgs.size();
size_t size = AbstractFifo<Msg*>::addMultiple(msgs);
if(size==inSize && mInterruptor)
{
// Only do this when the queue goes from empty to not empty.
mInterruptor->handleProcessNotification();
}
return size;
}

| void resip::Fifo< Msg >::clear | ( | ) | [virtual] |
| void resip::Fifo< Msg >::getMultiple | ( | Messages & | other, |
| unsigned int | max | ||
| ) |
Definition at line 145 of file Fifo.hxx.
References resip::AbstractFifo< T >::getMultiple().
Referenced by resip::ConsumerFifoBuffer< T >::getNext().
{
AbstractFifo<Msg*>::getMultiple(other, max);
}

| bool resip::Fifo< Msg >::getMultiple | ( | int | ms, |
| Messages & | other, | ||
| unsigned int | max | ||
| ) |
Definition at line 152 of file Fifo.hxx.
References resip::AbstractFifo< T >::getMultiple().
{
return AbstractFifo<Msg*>::getMultiple(ms, other, max);
}

| Msg * resip::Fifo< Msg >::getNext | ( | ) |
Returns the first message available.
It will wait if no messages are available. If a signal interrupts the wait, it will retry the wait. Signals can therefore not be caught via getNext. If you need to detect a signal, use block prior to calling getNext.
Reimplemented from resip::AbstractFifo< Msg * >.
Definition at line 129 of file Fifo.hxx.
References resip::AbstractFifo< T >::getNext().
Referenced by main(), and resip::DnsStub::processFifo().
{
return AbstractFifo<Msg*>::getNext();
}

| Msg * resip::Fifo< Msg >::getNext | ( | int | ms | ) |
Returns the next message available.
Will wait up to ms milliseconds if no information is available. If the specified time passes or a signal interrupts the wait, this method returns 0. This interface provides no mechanism to distinguish between timeout and interrupt.
Definition at line 136 of file Fifo.hxx.
References resip::AbstractFifo< T >::getNext().
{
Msg* result(0);
AbstractFifo<Msg*>::getNext(ms, result);
return result;
}

| Fifo& resip::Fifo< Msg >::operator= | ( | const Fifo< Msg > & | rhs | ) | [private] |
| void resip::Fifo< Msg >::setInterruptor | ( | AsyncProcessHandler * | interruptor | ) |
Definition at line 80 of file Fifo.hxx.
{
Lock lock(mMutex); (void)lock;
mInterruptor=interruptor;
}
AsyncProcessHandler* resip::Fifo< Msg >::mInterruptor [private] |
1.7.5.1