From 5a63ce8e0eca5dfc365227e071cd55643194d510 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 28 Jan 2018 11:36:51 +0100 Subject: [PATCH] Android service avoid shouldexit timer using all CPU available --- retroshare-android-service/src/service.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/retroshare-android-service/src/service.cpp b/retroshare-android-service/src/service.cpp index b95d7318a..4c36916e7 100644 --- a/retroshare-android-service/src/service.cpp +++ b/retroshare-android-service/src/service.cpp @@ -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();