projects
/
runfinite.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
setting new polling frequency -- maybe we should make it as parameter
[runfinite.git]
/
src
/
main.cpp
diff --git
a/src/main.cpp
b/src/main.cpp
index c9caf6e6e9def5691f51210495500c92c5a0f02f..c4648804283ad1d83e6a8990ddb1db6f58320a6a 100644
(file)
--- a/
src/main.cpp
+++ b/
src/main.cpp
@@
-182,10
+182,10
@@
int main(int argc, char** argv)
float loops=0;
//Status flags of child process
int status;
float loops=0;
//Status flags of child process
int status;
- //
100ms
granularity
- const int ussleep=
50
000;
+ //granularity
+ const int ussleep=
25
000;
- do
+ while(true)
{
//Kill the child
if( loops*ussleep/1e6 >= maxtime )
{
//Kill the child
if( loops*ussleep/1e6 >= maxtime )
@@
-197,15
+197,18
@@
int main(int argc, char** argv)
break;
}
break;
}
- //Sleep a round
- usleep(ussleep);
- loops++;
-
//Test for child
if( waitpid(-1, &status, WNOHANG | WUNTRACED | WCONTINUED) < 0 )
break;
//Test for child
if( waitpid(-1, &status, WNOHANG | WUNTRACED | WCONTINUED) < 0 )
break;
- }while( !WIFEXITED(status) );
+ if( WIFEXITED(status) )
+ break;
+
+ //Sleep a round
+ usleep(ussleep);
+ loops++;
+
+ }
}
}