reSIProcate/rutil  9694
Public Member Functions | Private Attributes
Producer Class Reference
Inheritance diagram for Producer:
Inheritance graph
[legend]
Collaboration diagram for Producer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Producer (TimeLimitFifo< Foo > &)
virtual ~Producer ()
void thread ()

Private Attributes

TimeLimitFifo< Foo > & mFifo

Detailed Description

Definition at line 59 of file testFifo.cxx.


Constructor & Destructor Documentation

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.

      {
#ifdef VERBOSE
         cerr << "Producer thread finishing" << endl;
#endif
         shutdown();
         join();
#ifdef VERBOSE
         cerr << "Producer thread finished" << endl;
#endif
      }

Member Function Documentation

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);
         }
      }
   }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 78 of file testFifo.cxx.

Referenced by thread().


The documentation for this class was generated from the following file: