All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
#include <InfiniteLoop.h>
Public Member Functions | |
| InfiniteLoop () | |
| bool | isRunning () const |
| void | start () |
| void | stop () |
| void | wait () |
| ~InfiniteLoop () | |
Protected Member Functions | |
| bool | isTerminated () const |
| void | setTerminated () |
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");
}
}
| 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;
}
| void GpCoreTools::InfiniteLoop::start | ( | ) | [inline] |
{
_state=Running;
}
| void GpCoreTools::InfiniteLoop::stop | ( | ) | [inline] |
{
if(_state==Running) {
_state=Terminate;
}
}
| void GpCoreTools::InfiniteLoop::wait | ( | ) |
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");
}
}