|
reSIProcate/rutil
9694
|
A templated, threadsafe message-queue class with a fixed size. More...
#include <FiniteFifo.hxx>


Public Member Functions | |
| FiniteFifo (unsigned int maxSize) | |
| virtual | ~FiniteFifo () |
| bool | add (Msg *msg) |
| Msg * | getNext () |
| Returns the first message available. | |
| Msg * | getNext (int ms) |
| Returns the next message available. | |
Private Attributes | |
| unsigned int | mMaxSize |
A templated, threadsafe message-queue class with a fixed size.
Definition at line 20 of file FiniteFifo.hxx.
| resip::FiniteFifo< Msg >::FiniteFifo | ( | unsigned int | maxSize | ) |
Definition at line 57 of file FiniteFifo.hxx.
: AbstractFifo<Msg*>(), mMaxSize(maxSize) { }
| resip::FiniteFifo< Msg >::~FiniteFifo | ( | ) | [virtual] |
| bool resip::FiniteFifo< Msg >::add | ( | Msg * | msg | ) |
Definition at line 76 of file FiniteFifo.hxx.
{
Lock lock(mMutex); (void)lock;
if (mFifo.size() >= mMaxSize)
{
return false;
}
else
{
mFifo.push_back(msg);
mCondition.signal();
return true;
}
}
| Msg * resip::FiniteFifo< 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 93 of file FiniteFifo.hxx.
References resip::AbstractFifo< T >::getNext().
{
return AbstractFifo<Msg*>::getNext();
}

| Msg * resip::FiniteFifo< 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 100 of file FiniteFifo.hxx.
References resip::AbstractFifo< T >::getNext().
{
Msg* result(0);
AbstractFifo<Msg*>::getNext(ms, result);
return result;
}

unsigned int resip::FiniteFifo< Msg >::mMaxSize [private] |
Definition at line 53 of file FiniteFifo.hxx.
1.7.5.1