android - UI thread sleeping even though postInvalidate() has been called to trigger onDraw() -


i have problem postinvalidate view. have thread called mainformviewrefresh wakes periodically , calls postinvalidate() method view. should wake main ui thread , call view's ondraw() method , have redrawn, main thread sleeping long times when postinvalidate() called.

the ui thread blocked on messagequeue#nativepollonce , doesn't wake postinvalidate(). why sleeping when has things do? missing postinvalidate() calls? understanding postinvalidate should put event in queue , wake ui thread blocking on nativepollonce. cpu 50% because sleeping half of time.

the picture illustrates problem. each spike of activity on mainformviewrefresh ends call postinvalidate(). periods of inactivity in main thread time spends blocked in messagequeue#nativepollonce. can seen, postinvalidate() called several times without waking main thread.

the main period of activity on main thread ondraw() (blue).

view of running threads


Comments