From 85448bbecd4e0909eecfab15b7c3605f114d0427 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 7 Jul 2010 14:27:31 -0700 Subject: Add new glue code for writing native apps. This factors out the boiler-plate code from the sample app to a common glue code that can be used for everyone writing this style of app: a dedicated app thread that takes care of waiting for events and processing them. As part of doing this, ALooper has a new facility to allow registration of fds that cause ALooper_pollOnce() to return the fd that has data, allowing the app to drive the loop without callbacks. Hopefully this makes some people feel better. :) Also do some other cleanup of the ALooper API, plus some actual documentation. Change-Id: Ic53bd56bdf627e3ba28a3c093faa06a92be522b8 --- core/jni/android_os_MessageQueue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/jni') diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp index 961f806..847b5a5 100644 --- a/core/jni/android_os_MessageQueue.cpp +++ b/core/jni/android_os_MessageQueue.cpp @@ -53,7 +53,7 @@ private: NativeMessageQueue::NativeMessageQueue() { mPollLoop = PollLoop::getForThread(); if (mPollLoop == NULL) { - mPollLoop = new PollLoop(); + mPollLoop = new PollLoop(false); PollLoop::setForThread(mPollLoop); } } @@ -62,7 +62,7 @@ NativeMessageQueue::~NativeMessageQueue() { } bool NativeMessageQueue::pollOnce(int timeoutMillis) { - return mPollLoop->pollOnce(timeoutMillis); + return mPollLoop->pollOnce(timeoutMillis) != PollLoop::POLL_TIMEOUT; } void NativeMessageQueue::wake() { -- cgit v1.1