Using the TimeHires module and interupting the main loop for
10 miliseconds will reduce the cpu load of guardian to almost
zero instead of burning it.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
use Getopt::Long;
use Thread::Queue;
use Linux::Inotify2;
+use Time::HiRes qw[ time sleep ];
require Guardian::Config;
require Guardian::Parser;
$queue->dequeue();
}
- # XXX
- # Temporary workaround to reduce the load of the main process.
- sleep(1);
+ # Sleep 10ms to reduce the load of the main process.
+ sleep(0.01);
}
#