summaryrefslogtreecommitdiffstats
path: root/include/utils/Looper.h
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-05-06 14:25:20 -0700
committerAlex Ray <aray@google.com>2013-07-30 13:57:01 -0700
commit19159f90020c04ac2f4dcb39424d740f765ed9a3 (patch)
tree242326311d0ad5ce0d2ce40cfc02f07a222479ae /include/utils/Looper.h
parentd9ad7d8d73918d44d41811e9b4d0cc722dae338d (diff)
downloadcore-19159f90020c04ac2f4dcb39424d740f765ed9a3.tar.gz
core-19159f90020c04ac2f4dcb39424d740f765ed9a3.tar.bz2
core-19159f90020c04ac2f4dcb39424d740f765ed9a3.zip
Add new Looper API to check whether the looper is idle.
This is just to support the watchdog to give it a faster way to determine if a thread is deadlocked without having to post a message to it. Change-Id: I068dc8b9387caf94fe5811fb4aeb0f9b57b1a080
Diffstat (limited to 'include/utils/Looper.h')
-rw-r--r--include/utils/Looper.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/utils/Looper.h b/include/utils/Looper.h
index d4a0067fd..2e0651a3c 100644
--- a/include/utils/Looper.h
+++ b/include/utils/Looper.h
@@ -297,6 +297,13 @@ 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.
+ */
+ bool isIdling() const;
+
+ /**
* Prepares a looper associated with the calling thread, and returns it.
* If the thread already has a looper, it is returned. Otherwise, a new
* one is created, associated with the thread, and returned.
@@ -353,6 +360,10 @@ private:
Vector<MessageEnvelope> mMessageEnvelopes; // guarded by mLock
bool mSendingMessage; // guarded by mLock
+ // Whether we are currently waiting for work. Not protected by a lock,
+ // any use of it is racy anyway.
+ volatile bool mIdling;
+
int mEpollFd; // immutable
// Locked list of file descriptor monitoring requests.