Commit Graph

3 Commits

Author SHA1 Message Date
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
b0619e8ad8 Looper: Drop default parameters in favor of a safer overload.
The idea is that if you're writing code that wants fd/events/data on
return from pollOnce() / pollAll() you should really pass in all of those
arguments.  When I changed the Looper API earlier, it was difficult
to ensure that all callers were passing the right parameters since they
were relying on default parameters to some degree so usage mistakes
would not have been caught by the compiler.

Change-Id: I1f2812894270aaf1515017ac1616b6b312d9b565
2010-09-16 18:51:15 -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