summaryrefslogtreecommitdiffstats
path: root/libutils/Looper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Work around spurious epoll notifications.Jeff Brown2015-05-291-0/+5
| | | | | | | | | | Sometimes it seems like we can get into a situation where we are unable to remove an fd from the epoll set but it keeps sending us events anyhow. Defensively rebuild the epoll set in this case to prevent us from spinning forever. Bug: 21271428 Change-Id: I5607e565f2e12460d7113a1f62a70d38d334e271
* Use eventfd instead of pipe in Looper.Tim Kilbourn2015-03-271-32/+14
| | | | | Bug: 19933224 Change-Id: I6611e918db960bbb0e74f8308e10bdf79510b899
* Fix issues related to removing Looper callbacks after close.Jeff Brown2015-03-121-32/+94
| | | | | | | | | | | | | | | | | When a file descriptor is closed before removing it from the epoll set, it will normally be removed automatically from the epoll set by the kernel. However if there exists a duplicate then the original file descriptor may remain in the set and continue to receive events until all duplicates have been closed. Unfortunately due to kernel limitations we need to rebuild the epoll set from scratch because it may contain an old file handle that we are now unable to remove since its file descriptor is no longer valid. No such problem would have occurred if we were using the poll system call instead, but that approach carries others disadvantages. Bug: 19715279 Change-Id: If1ab8ebda0825755a416d513e888942a02ee3948
* Fixed subtle bugs related to file descriptor recycling.Jeff Brown2015-03-111-11/+66
| | | | | | | | | | | | | | | Added code to protect against situations that may occur when a Looper callback has the side-effect of closing the file descriptor that it is watching before it returns. This code pattern is very convenient for implementation but it does expose issues in how the list of callbacks is maintained. In particular, we need to watch out for file descriptors which have been reused. This change may resolve previously unexplained ANRs associated with log messages such as: "Error modifying epoll events for fd 44, errno=2" Bug: 10349083 Change-Id: I20eedf6ffbdeda382653ca0104962505194741b0
* Rename Looper::isIdling() to isPolling() to resolve confusion.Jeff Brown2015-03-111-5/+5
| | | | | | | | | The loop isn't technically idle at this time, it's just checking whether any file descriptors have pending events. However it's still a good signal as to whether the loop is alive. Bug: 19532373 Change-Id: I555c473e70ffd8a56e1b10aa60026eb674a16de9
* Make libutils Looper independent of frameworks/nativeBrian Carlstrom2013-12-181-20/+20
| | | | Change-Id: I1dacca10a3cd7601abc3451b69ed761bf71c38fe
* move libs/utils to libutilsAlex Ray2013-08-021-0/+573
Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d