-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
looper: Provide
event
value to file descriptor poll callback (#435)
When `looper` calls a callback that triggered for a poll on a file descriptor it provides the reason for the wakeup, because users are allowed to register multiple. Hence it is important for the user to know the trigger reason to enact on the result appropriately. E.g. a `HANGUP` typically requires the callback to be deregistered by returning `false`, as the other end (for a `pipe()` or `socket()`) has been closed and this file descriptor should no longer trigger any other event. Note that various events are received by this callback regardless of whether the user registered it with that flag in `events`. This is all reflected by updating the documentation comments for `FdEvent` based on upstream Android documentation. Keep in mind that `FdEvent` is a `bitflag`, and Android uses that to batch up multiple events. E.g. writing to a `pipe()` and closing the write `fd` - while the read `fd` is registered in a callback - causes the callback (from a subsequent `looper.poll*()`) to be called with `INPUT | HANGUP`, indicating that there is data to read but that the file descriptor will be dormant after that.
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters