From 7a17b608de24e3aaf7d5ca030bb80a74dcc3baf9 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 17 Nov 2010 17:58:29 +0100 Subject: Implementation of event loop abstraction. This patch adds "android/looper.h" which provides an abstraction for event loops: - android/looper-qemu.c implements it on top of the QEMU main event loop. - android/looper-generic.c implements it on top of an IoLooper object. The main idea is to move the UI-related code to use the abstraction to handle timers and asynchronous (network) i/o. NOTE: Code compiles but has not been heavily tested. Change-Id: Ib6820c1b9a9950dc22449a332bc1b066a07af203 --- android/utils/refset.h | 6 ++++++ android/utils/vector.h | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'android/utils') diff --git a/android/utils/refset.h b/android/utils/refset.h index 12cc240..d734999 100644 --- a/android/utils/refset.h +++ b/android/utils/refset.h @@ -34,6 +34,12 @@ arefSet_done( ARefSet* s ) AVECTOR_DONE(s,buckets); } +AINLINED void +arefSet_clear( ARefSet* s ) +{ + AVECTOR_CLEAR(s,buckets); +} + AINLINED int arefSet_count( ARefSet* s ) { diff --git a/android/utils/vector.h b/android/utils/vector.h index e591055..c576ec7 100644 --- a/android/utils/vector.h +++ b/android/utils/vector.h @@ -44,6 +44,11 @@ (obj)->max_##name = 0; \ } while (0) +#define AVECTOR_CLEAR(obj,name) \ + do { \ + (obj)->num_##name = 0; \ + } while (0) + #define AVECTOR_AT(obj,name,index) \ (&(obj)->name[(index)]) -- cgit v1.1