Android service avoid shouldexit timer using all CPU available

This commit is contained in:
Gioacchino Mazzurco 2018-01-28 11:36:51 +01:00
parent 3e5ed6af9e
commit 5a63ce8e0e

View File

@ -60,9 +60,12 @@ int main(int argc, char *argv[])
ApiServerLocal apiServerLocal(&api, sockPath); (void) apiServerLocal;
// This ugly but RsControlModule has no other way to callback for stop
QTimer shouldExitTimer;
shouldExitTimer.setTimerType(Qt::VeryCoarseTimer);
shouldExitTimer.setInterval(1000);
QObject::connect( &shouldExitTimer, &QTimer::timeout, [&](){
if(ctrl_mod.processShouldExit()) app.quit(); });
if(ctrl_mod.processShouldExit()) app.quit(); } );
shouldExitTimer.start();
return app.exec();