aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/cloudthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/cloud/cloudthread.cpp')
-rw-r--r--backends/cloud/cloudthread.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/backends/cloud/cloudthread.cpp b/backends/cloud/cloudthread.cpp
index f8d93d2baa..813354f43f 100644
--- a/backends/cloud/cloudthread.cpp
+++ b/backends/cloud/cloudthread.cpp
@@ -23,6 +23,8 @@
#include "cloudthread.h"
#include "common/debug.h"
#include "common/json.h"
+#include "common/system.h"
+#include "common/timer.h"
void example1();
void example2();
@@ -30,10 +32,10 @@ void example3();
void cloudThread(void *thread) {
CloudThread *cloudThread = (CloudThread *)thread;
- cloudThread->work();
+ cloudThread->handler();
};
-void CloudThread::work() {
+void CloudThread::handler() {
if (_firstTime) {
_firstTime = false;
@@ -43,6 +45,21 @@ void CloudThread::work() {
} else { }
}
+void CloudThread::setTimeout(int interval) {
+ Common::TimerManager *manager = g_system->getTimerManager();
+ if (!manager->installTimerProc(cloudThread, interval, this, "Cloud Thread"))
+ warning("Failed to create cloud thread");
+}
+
+void CloudThread::unsetTimeout() {
+ Common::TimerManager *manager = g_system->getTimerManager();
+ manager->removeTimerProc(cloudThread);
+}
+
+void CloudThread::start() {
+ setTimeout(1000000); //in one second
+}
+
/// SimpleJSON examples:
using Common::JSON;