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

Replace ALooper_pollAll with ALooper_pollOnce #477

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

Keenuts
Copy link
Member

@Keenuts Keenuts commented Jun 3, 2024

This commit is sourced from a downstream patch.

The incoming NDK r27 removes ALooper_pollAll as it can't be called safely.

See android/ndk#2020 for more context.

While this change strives to introduce as little behavior change as possible, Some behavior changes might be happening.

  1. We are failing more explicitly when ALooper_pollOnce returns ALOOPER_POLL_ERROR. When this error is returned, there is no point in retrying polling in the current thread.
  2. Compared with ALooper_pollAll, ALooper_pollOnce can return more frequently with ALOOPER_POLL_CALLBACK. This can lead to "on_idle" logic being executed more frequently.
This commit is sourced from a downstream patch.

The incoming NDK r27 removes `ALooper_pollAll` as it can't be called safely.

See android/ndk#2020 for more context.

While this change strives to introduce as little behavior change as possible,
Some behavior changes might be happening.
  1. We are failing more explicitly when `ALooper_pollOnce` returns
     `ALOOPER_POLL_ERROR`. When this error is returned, there is no
     point in retrying polling in the current thread.
  2. Compared with `ALooper_pollAll`, `ALooper_pollOnce` can return more
     frequently with `ALOOPER_POLL_CALLBACK`. This can lead to "on_idle"
     logic being executed more frequently.

Co-Authored-By: google-yfyang <yfyang@google.com>
Signed-off-by: Nathan Gauër <brioche@google.com>
@Keenuts Keenuts requested a review from apazylbe June 3, 2024 15:27
@Keenuts Keenuts enabled auto-merge (squash) June 3, 2024 18:35
@Keenuts Keenuts merged commit 334178e into google:main Jun 4, 2024
5 checks passed
@Keenuts Keenuts deleted the android-migration branch June 5, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants