summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2015-02-26 14:16:30 -0800
committerJeff Brown <jeffbrown@google.com>2015-03-11 15:00:36 -0700
commit27e5721860142b1b20081b535c55e7917366385f (patch)
tree1f9e7bc2331e0ba78aac23880982c65da85ea412
parent40ed4f5d5ea0f9fa38ecbaa5fed7163b72e90063 (diff)
downloadsystem_core-27e5721860142b1b20081b535c55e7917366385f.tar.gz
system_core-27e5721860142b1b20081b535c55e7917366385f.tar.bz2
system_core-27e5721860142b1b20081b535c55e7917366385f.zip
Rename Looper::isIdling() to isPolling() to resolve confusion.
The loop isn't technically idle at this time, it's just checking whether any file descriptors have pending events. However it's still a good signal as to whether the loop is alive. Bug: 19532373 Change-Id: I555c473e70ffd8a56e1b10aa60026eb674a16de9
-rw-r--r--include/utils/Looper.h11
-rw-r--r--libutils/Looper.cpp10
2 files changed, 11 insertions, 10 deletions
diff --git a/include/utils/Looper.h b/include/utils/Looper.h
index 15c989176..dae7833be 100644
--- a/include/utils/Looper.h
+++ b/include/utils/Looper.h
@@ -386,11 +386,12 @@ public:
void removeMessages(const sp<MessageHandler>& handler, int what);
/**
- * Return whether this looper's thread is currently idling -- that is, whether it
- * stopped waiting for more work to do. Note that this is intrinsically racy, since
- * its state can change before you get the result back.
+ * Returns whether this looper's thread is currently polling for more work to do.
+ * This is a good signal that the loop is still alive rather than being stuck
+ * handling a callback. Note that this method is intrinsically racy, since the
+ * state of the loop can change before you get the result back.
*/
- bool isIdling() const;
+ bool isPolling() const;
/**
* Prepares a looper associated with the calling thread, and returns it.
@@ -451,7 +452,7 @@ private:
// Whether we are currently waiting for work. Not protected by a lock,
// any use of it is racy anyway.
- volatile bool mIdling;
+ volatile bool mPolling;
int mEpollFd; // immutable
diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp
index 9a2dd6cc4..9ba17970b 100644
--- a/libutils/Looper.cpp
+++ b/libutils/Looper.cpp
@@ -84,7 +84,7 @@ Looper::Looper(bool allowNonCallbacks) :
LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake write pipe non-blocking. errno=%d",
errno);
- mIdling = false;
+ mPolling = false;
// Allocate the epoll instance and register the wake pipe.
mEpollFd = epoll_create(EPOLL_SIZE_HINT);
@@ -217,13 +217,13 @@ int Looper::pollInner(int timeoutMillis) {
mResponseIndex = 0;
// We are about to idle.
- mIdling = true;
+ mPolling = true;
struct epoll_event eventItems[EPOLL_MAX_EVENTS];
int eventCount = epoll_wait(mEpollFd, eventItems, EPOLL_MAX_EVENTS, timeoutMillis);
// No longer idling.
- mIdling = false;
+ mPolling = false;
// Acquire lock.
mLock.lock();
@@ -566,8 +566,8 @@ void Looper::removeMessages(const sp<MessageHandler>& handler, int what) {
} // release lock
}
-bool Looper::isIdling() const {
- return mIdling;
+bool Looper::isPolling() const {
+ return mPolling;
}
} // namespace android