reSIProcate/repro  9694
Functions | Variables
repro.cxx File Reference
#include <signal.h>
#include "repro/ReproRunner.hxx"
#include "rutil/Socket.hxx"
#include "rutil/WinLeakCheck.hxx"
Include dependency graph for repro.cxx:

Go to the source code of this file.

Functions

static void signalHandler (int signo)
int main (int argc, char **argv)

Variables

static bool finished = false

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 76 of file repro.cxx.

{
   // Install signal handlers
#ifndef _WIN32
   if ( signal( SIGPIPE, SIG_IGN) == SIG_ERR)
   {
      cerr << "Couldn't install signal handler for SIGPIPE" << endl;
      exit(-1);
   }
#endif

   if ( signal( SIGINT, signalHandler ) == SIG_ERR )
   {
      cerr << "Couldn't install signal handler for SIGINT" << endl;
      exit( -1 );
   }

   if ( signal( SIGTERM, signalHandler ) == SIG_ERR )
   {
      cerr << "Couldn't install signal handler for SIGTERM" << endl;
      exit( -1 );
   }

   // Initialize network
   initNetwork();

#if defined(WIN32) && defined(_DEBUG) && defined(LEAK_CHECK) 
   { FindMemoryLeaks fml;
#endif

   ReproRunner repro;
   if(!repro.run(argc, argv))
   {
      cerr << "Failed to start repro, exiting..." << endl;
      exit(-1);
   }

   // Main program thread, just waits here for a signal to shutdown
   while (!finished)
   {
#ifdef WIN32
   Sleep(1000);
#else
   usleep(100000);
#endif
   }

   repro.shutdown();

#if defined(WIN32) && defined(_DEBUG) && defined(LEAK_CHECK) 
   }
#endif
   return 0;
}
static void signalHandler ( int  signo) [static]

Definition at line 19 of file repro.cxx.

{
   std::cerr << "Shutting down" << endl;
   finished = true;
}

Variable Documentation

bool finished = false [static]

Definition at line 16 of file repro.cxx.