projects
/
runfinite.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3c83d36
)
improved performance very fast terminating commands
author
Stefan Huber <shuber2@gmail.com>
Sat, 26 Apr 2008 08:27:26 +0000
(10:27 +0200)
committer
Stefan Huber <shuber2@gmail.com>
Sat, 26 Apr 2008 08:27:26 +0000
(10:27 +0200)
src/main.cpp
patch
|
blob
|
history
diff --git
a/src/main.cpp
b/src/main.cpp
index c9caf6e6e9def5691f51210495500c92c5a0f02f..345c5d379a248cd9bc686610cedc8dbd3f5cf47e 100644
(file)
--- a/
src/main.cpp
+++ b/
src/main.cpp
@@
-183,9
+183,9
@@
int main(int argc, char** argv)
//Status flags of child process
int status;
//100ms granularity
//Status flags of child process
int status;
//100ms granularity
- const int ussleep=
5
0000;
+ const int ussleep=
10
0000;
- 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++;
+
+ }
}
}