reSIProcate/stack  9694
Classes | Defines | Functions
testSelectInterruptor.cxx File Reference
#include <iostream>
#include "rutil/SelectInterruptor.hxx"
#include "rutil/Logger.hxx"
#include "rutil/DataStream.hxx"
#include "rutil/ThreadIf.hxx"
Include dependency graph for testSelectInterruptor.cxx:

Go to the source code of this file.

Classes

class  FakeApp

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Functions

int main (int argc, char *argv[])

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Definition at line 23 of file testSelectInterruptor.cxx.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 60 of file testSelectInterruptor.cxx.

References resip::SelectInterruptor::buildFdSet(), InfoLog, initNetwork(), resip::ThreadIf::isShutdown(), resip::ThreadIf::join(), resip::SelectInterruptor::process(), resip::ThreadIf::run(), resip::FdSet::selectMilliSeconds(), and resip::ThreadIf::shutdown().

{
#ifdef WIN32
        initNetwork();
#endif

   Log::initialize(Log::Cout, Log::Debug, argv[0]);
   
   SelectInterruptor si;
   FakeApp app(si);

   InfoLog(<< "Starting FakeApp");
   app.run();

   int numWakeups = 0;
   while(!app.isShutdown())
   {
      FdSet fdset;
      si.buildFdSet(fdset);
      
      int ret = fdset.selectMilliSeconds(10000);
      
      if (ret > 0)
      {
         InfoLog(<< "Select detected: " << ret << " ready descriptors");
         si.process(fdset);
         numWakeups++;
      }
      else
      {
         InfoLog(<< "Select detected no ready descriptors, test failed");
         break;
      }
   }

   if (numWakeups == 6)
   {
      InfoLog(<< "Finished, test passed");
   }
   app.shutdown();
   app.join();
}

Here is the call graph for this function: