|
reSIProcate/rutil
9694
|


Public Member Functions | |
| Producer (TimeLimitFifo< Foo > &) | |
| virtual | ~Producer () |
| void | thread () |
Private Attributes | |
| TimeLimitFifo< Foo > & | mFifo |
Definition at line 59 of file testFifo.cxx.
| Producer::Producer | ( | TimeLimitFifo< Foo > & | f | ) |
Definition at line 115 of file testFifo.cxx.
: mFifo(f) {}
| virtual Producer::~Producer | ( | ) | [inline, virtual] |
Definition at line 63 of file testFifo.cxx.
| void Producer::thread | ( | ) | [virtual] |
Implements resip::ThreadIf.
Definition at line 119 of file testFifo.cxx.
References resip::TimeLimitFifo< Msg >::add(), mFifo, resip::AbstractFifo< T >::size(), sleepMS(), and resip::TimeLimitFifo< Msg >::wouldAccept().
{
static unsigned wakeups[6] = { 0, 10, 0, 20, 30, 10 };
unsigned int w = 0;
#ifdef VERBOSE
cerr << "Producer running..." << endl;
#endif
for (unsigned long n = 0; n < 0x1ffff; n++)
{
if (mFifo.wouldAccept(TimeLimitFifo<Foo>::EnforceTimeDepth))
{
mFifo.add(new Foo(Data(n)), TimeLimitFifo<Foo>::EnforceTimeDepth);
}
else
{
unsigned wakeup = wakeups[w];
w = (w + 1) % 6;
#ifdef VERBOSE
cerr << "Producer sleeping for " << wakeup << " ms at " << n << " with mSize " << mFifo.size() << endl;
#endif
if (wakeup > 0)
{
sleepMS(wakeup);
}
}
}
}

TimeLimitFifo<Foo>& Producer::mFifo [private] |
Definition at line 78 of file testFifo.cxx.
Referenced by thread().
1.7.5.1