Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndk/looper: Deprecate poll_all*() and document implied wake results #491

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarijnS95
Copy link
Member

Upstream clarified that due to limitations in ALooper, the poll*() functions may not be able to distinguish an explicit wake() call from any other wakeup source, including callbacks, timeouts, fd events or even errors. Any return value from these functions should be treated as if a Poll::Wake event is also returned.

While this is not only problematic to tell a wake apart from other events, it makes it impossible for the poll_all*() variants to return correctly as they will keep looping internally on callbacks (which are subsuming a wake event). According to upstream ALooper_pollAll() documentation this is considered "not safe" and the function is no longer allowed to be called.

[Upstream clarified] that due to limitations in `ALooper`, the `poll*()`
functions may not be able to distinguish an explicit `wake()` call from
any other wakeup source, including callbacks, timeouts, fd events or
even errors.  Any return value from these functions should be treated as
if a `Poll::Wake` event is also returned.

While this is not only problematic to tell a wake apart from other
events, it makes it impossible for the `poll_all*()` variants to return
correctly as they will keep looping internally on callbacks (which are
subsuming a wake event).  According to [upstream `ALooper_pollAll()`
documentation] this is considered "not safe" and the function is no
longer allowed to be called.

[Upstream clarified]: android/ndk#2020
[upstream `ALooper_pollAll()` documentation]: https://developer.android.com/ndk/reference/group/looper#alooper_pollall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant