summaryrefslogtreecommitdiff
path: root/core/java/android/os/Handler.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-02-16 14:41:10 -0800
committerJeff Brown <jeffbrown@google.com>2012-02-16 14:58:33 -0800
commit0f85ce3837633a03460a61405087a5d28a4bf955 (patch)
tree9aad2847d51b81de52dd546559f2805bb761d974 /core/java/android/os/Handler.java
parenta175a5b7ea3682cb58cca7f9726d0b8171cd549d (diff)
Improve MessageQueue sync barrier implementation.
Instead of acquiring and releasing a barrier using an up/down counter, we post a message to the queue that represents the barrier. This is a more natural representation of the barrier and better matches what we want to do with it: stall messages behind the barrier in the queue while allowing messages earlier in the queue to run as usual. Refactored the MessageQueue a little bit to simplify the quit logic and to better encapsulate the invariant that all messages within the queue must have a valid target. Messages without targets are used to represent barriers. Bug: 5721047 Change-Id: Id297d9995474b5e3f17d24e302c58168e0a00394
Diffstat (limited to 'core/java/android/os/Handler.java')
-rw-r--r--core/java/android/os/Handler.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java
index af2fa9bf1ffa..610b3550402a 100644
--- a/core/java/android/os/Handler.java
+++ b/core/java/android/os/Handler.java
@@ -513,7 +513,7 @@ public class Handler {
* message queue.
*/
public final void removeMessages(int what) {
- mQueue.removeMessages(this, what, null, true);
+ mQueue.removeMessages(this, what, null);
}
/**
@@ -522,7 +522,7 @@ public class Handler {
* all messages will be removed.
*/
public final void removeMessages(int what, Object object) {
- mQueue.removeMessages(this, what, object, true);
+ mQueue.removeMessages(this, what, object);
}
/**
@@ -539,7 +539,7 @@ public class Handler {
* the message queue.
*/
public final boolean hasMessages(int what) {
- return mQueue.removeMessages(this, what, null, false);
+ return mQueue.hasMessages(this, what, null);
}
/**
@@ -547,7 +547,7 @@ public class Handler {
* whose obj is 'object' in the message queue.
*/
public final boolean hasMessages(int what, Object object) {
- return mQueue.removeMessages(this, what, object, false);
+ return mQueue.hasMessages(this, what, object);
}
// if we can get rid of this method, the handler need not remember its loop