From 3c83d365539867dc65d21dbf11abe4b13a1b2153 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Thu, 24 Apr 2008 16:29:44 +0200 Subject: [PATCH] changing sleep to usleep for higher responsivness --- src/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d6d5692..c9caf6e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -181,12 +181,14 @@ int main(int argc, char** argv) //Nmb of loops=seconds float loops=0; //Status flags of child process - int status, w; + int status; + //100ms granularity + const int ussleep=50000; do { //Kill the child - if( loops >= maxtime ) + if( loops*ussleep/1e6 >= maxtime ) { if( argVerbose ) printf("Kill child...\n"); @@ -196,7 +198,7 @@ int main(int argc, char** argv) } //Sleep a round - sleep(1); + usleep(ussleep); loops++; //Test for child -- 2.30.2