From 1bb627cd086588d3f9650fac04f4034961caf9f1 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Thu, 18 Nov 2010 16:10:45 +0100 Subject: 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 --- android/looper-qemu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'android/looper-qemu.c') 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 +#include #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; -- cgit v1.1