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

List of all members.

Public Member Functions

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

Private Attributes

TimeLimitFifo< Foo > & mFifo

Detailed Description

Definition at line 37 of file testFifo.cxx.


Constructor & Destructor Documentation

Consumer::Consumer ( TimeLimitFifo< Foo > &  f)

Definition at line 81 of file testFifo.cxx.

                                        :
   mFifo(f)
{}
virtual Consumer::~Consumer ( ) [inline, virtual]

Definition at line 41 of file testFifo.cxx.

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

Member Function Documentation

void Consumer::thread ( ) [virtual]

Implements resip::ThreadIf.

Definition at line 85 of file testFifo.cxx.

References resip::TimeLimitFifo< Msg >::getNext(), resip::AbstractFifo< T >::messageAvailable(), mFifo, resip::ThreadIf::mShutdown, resip::AbstractFifo< T >::size(), and sleepMS().

{
    static unsigned wakeups[6] = { 10, 20, 30, 0, 10, 30 };
    unsigned int w = 0;

#ifdef VERBOSE
    cerr << "Consumer running..." << endl;
#endif

    while (!mShutdown) 
    {
       if (mFifo.messageAvailable())
       {
          delete mFifo.getNext(100);
       }
       else
       {
          unsigned wakeup = wakeups[w];
          w = (w + 1) % 6;
#ifdef VERBOSE
          cerr << "Consumer sleeping for " << wakeup << " ms 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 56 of file testFifo.cxx.

Referenced by thread().


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