All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Protected Member Functions
GpCoreTools::InfiniteLoop Class Reference

#include <InfiniteLoop.h>

List of all members.

Public Member Functions

 InfiniteLoop ()
bool isRunning () const
void start ()
void stop ()
void wait ()
 ~InfiniteLoop ()

Protected Member Functions

bool isTerminated () const
void setTerminated ()

Constructor & Destructor Documentation

Description of constructor still missing

{
  _state=NotRunning;
}

Description of destructor still missing

References isRunning(), and GpCoreTools::Log::write().

{
  if(isRunning()) {
    Log::write(1, "loop destroyed while running\n");
  }
}

Member Function Documentation

bool GpCoreTools::InfiniteLoop::isRunning ( ) const [inline]

Referenced by wait(), and ~InfiniteLoop().

{
  return _state!=NotRunning;
}
bool GpCoreTools::InfiniteLoop::isTerminated ( ) const [inline, protected]
{
  return _state==Terminate;
}
void GpCoreTools::InfiniteLoop::setTerminated ( ) [inline, protected]
{
  _state=NotRunning;
}
{
  _state=Running;
}
{
  if(_state==Running) {
    _state=Terminate;
  }
}

Wait a maximum of 10 seconds for process to end.

References isRunning(), and GpCoreTools::Log::write().

{
  int elapsed=0;
  while(isRunning() && elapsed<1000) {
    usleep(10000);  // 10 ms
    elapsed++;
  }
  if(elapsed==1000) {
    Log::write(0, "time out\n");
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines