Bug in sendMessageAtFrontOfQueue and or enqueueMessage

15 views
Skip to first unread message

Wink Saville

unread,
Dec 27, 2007, 5:51:08 PM12/27/07
to android-d...@googlegroups.com, androi...@googlegroups.com
Hello,

I believe there is a bug in sendMessageAtFrontOfQueue when I use this
call twice in a row:

msg1.what = 1;
sendMessageAtFrontOfQueue(msg1);
msg2.what = 2;
sendMessageAtFrontOfQueue(msg2);

The order seen by android.os.Handler.handleMessage is msg1 comes
first then msg2, I would expect the opposite as msg2 was asked to
be placed at the front of the queue after msg1.

I looked a little deeper and sendMessageAtFrontOfQueue calls
android.os.MessageQueue.enqueueMessage(msg, when) with when=0.
Apparently when enqueueMessage finds that msg2.when == msg1.when
so it decides to place msg2 after msg1. If in the debugger I set msg1.when=1
just before calling sendMessageAtFrontOfQueue then I see the "proper"
behavior and msg2 is before msg1. So I believe this is a bug
in enqueueMessage.

Note; if the sources were released patches could be submitted
and we would all benefit! At a minimum we should be able to
report bugs to a bug reporting system. In that this doesn't seem
to exist I've taken the liberty of creating a group where they
can be reported:

* Group name: android-bugs
* Group home page: http://groups.google.com/group/android-bugs?hl=en
* Group email address androi...@googlegroups.com

Regards,

Wink Saville

Reply all
Reply to author
Forward
0 new messages