Commit Graph

5 Commits

Author SHA1 Message Date
Jeff Brown
54e1cdacd2 Switch Looper back to using poll() instead of epoll().
Added a couple of micro-optimizations to avoid calling wake() unnecessarily
and reduce JNI overhead slightly.

Fixed a minor issue where we were not clearing the "next" field of Messages
returned by the MessageQueue so the Message would hold on to its successor
and potentially prevent the GC from collecting it if the message were leaked
somehow.

Change-Id: I488d29417ce0cdd7d0e447cda76ec978ef7f811c
2010-10-07 13:26:39 -07:00
Jeff Brown
61a25b2490 Looper: use pthread_once for TLS key initialization.
Also fix a Valgrind complaint by zeroing out the entire epoll event
struct since otherwise the data field union would be partly
uninitialized (but not in a harmful way).

Change-Id: I2091ce517e87fcad7c9caf90e2c5e4854a7ca465
2010-09-21 15:26:51 -07:00
Jeff Brown
ed242de3f5 Reduce lock thrashing in native Looper.
In the common case, there is nothing interesting happening on the native
Looper besides occasional wake ups.  There is no point grabbing the
semaphore then.

Change-Id: Ib5c426d0e158dfa37891b7ff5537b6f833592fad
2010-09-17 17:01:23 -07:00
Jeff Brown
f67f299036 Ensure input dispatcher and native looper handles EINTR.
Change-Id: I0a42db5f273b9bfe4ab174e4ee65d5d852f9f6bc
2010-09-16 17:04:52 -07:00
Jeff Brown
59abe7e090 Replace epoll() with poll() and rename PollLoop to Looper.
As part of this change, consolidated and cleaned up the Looper API so
that there are fewer distinctions between the NDK and non-NDK declarations
(no need for two callback types, etc.).

Removed the dependence on specific constants from sys/poll.h such as
POLLIN.  Instead looper.h defines events like LOOPER_EVENT_INPUT for
the events that it supports.  That should help make any future
under-the-hood implementation changes easier.

Fixed a couple of compiler warnings along the way.

Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
2010-09-14 01:59:45 -07:00