aboutsummaryrefslogtreecommitdiffstats
path: root/android/looper-qemu.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-11-18 16:10:45 +0100
committerDavid 'Digit' Turner <digit@android.com>2010-11-19 14:51:17 +0100
commit1bb627cd086588d3f9650fac04f4034961caf9f1 (patch)
tree2f12b3074cd6314f9556d21f074508d66c03d971 /android/looper-qemu.c
parent3aa86ac4b79c71e443d3010a84bed1da27f48880 (diff)
downloadexternal_qemu-1bb627cd086588d3f9650fac04f4034961caf9f1.zip
external_qemu-1bb627cd086588d3f9650fac04f4034961caf9f1.tar.gz
external_qemu-1bb627cd086588d3f9650fac04f4034961caf9f1.tar.bz2
Fix generic looper implementation
+ allow looper_run() to return a value that indicates why it exited. + add looper_runWithDeadline() and looper_runWithTimeout() in the case where you want to run only for a limited time. looper_runWithTimeout(looper,0) can be used to poll the event state and return asap after firing all the callbacks. + fix iolooper_modify() Change-Id: Iba3b0385a7fd8d90f4f3334ebf313e79267f7b3d
Diffstat (limited to 'android/looper-qemu.c')
-rw-r--r--android/looper-qemu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/android/looper-qemu.c b/android/looper-qemu.c
index 0e55658..400f7c1 100644
--- a/android/looper-qemu.c
+++ b/android/looper-qemu.c
@@ -13,6 +13,7 @@
/* Implement the Looper interface on top of the QEMU main event loop */
#include <android/looper.h>
+#include <android/utils/panic.h>
#include "qemu-common.h"
#include "qemu-timer.h"
#include "qemu-char.h"
@@ -370,6 +371,15 @@ qlooper_forceQuit(Looper* ll)
qemu_system_shutdown_request();
}
+/* The user cannot call looper_run on the core event loop, because it
+ * is started by qemu_main() explicitely instead, so just panic. */
+int
+qlooper_run(Looper* ll, Duration deadline_ms)
+{
+ APANIC("Trying to run the QEMU main event loop explicitely!");
+ return EINVAL;
+}
+
static void
qlooper_destroy(Looper* ll)
{
@@ -395,6 +405,7 @@ looper_newCore(void)
looper->looper.now = qlooper_now;
looper->looper.timer_init = qlooper_timer_init;
looper->looper.io_init = qlooper_io_init;
+ looper->looper.run = qlooper_run;
looper->looper.forceQuit = qlooper_forceQuit;
looper->looper.destroy = qlooper_destroy;