Skip to content

Use ALooper_pollOnce instead of pollAll#224

Merged
rib merged 1 commit intomainfrom
rib/pr/avoid-deprecated-poll-all
Mar 2, 2026
Merged

Use ALooper_pollOnce instead of pollAll#224
rib merged 1 commit intomainfrom
rib/pr/avoid-deprecated-poll-all

Conversation

@rib
Copy link
Member

@rib rib commented Mar 2, 2026

The ALooper_pollAll API is deprecated and considering that poll_events never promised the behaviour of pollAll we simply change the implementation to use ALoooper_pollOnce and assume the caller is going to anyway be calling poll_events within its own loop.

Note: pollOnce can still deliver multiple callback events, and the "once" effectively just refers to only calling epoll_wait at most once.

Considering winit for example, this should have no effect since winit will be calling poll_events in a loop with no assumption about how concurrent events could potentially be batched.

Fixes: #170

@rib
Copy link
Member Author

rib commented Mar 2, 2026

Double checking running an updated version of na-egui from the rust-examples with this change, winit doesn't seem to be affected by this.

edit. err.., well that would make sense at the very least because I have so far only updated the game-activity backend ...

The `ALooper_pollAll` API is deprecated and considering that `poll_events`
never promised the behaviour of `pollAll` we simply change the
implementation to use `ALoooper_pollOnce` and assume the caller is going
to anyway be calling `poll_events` within its own loop.

Note: `pollOnce` can still deliver multiple callback events, and the
"once" effectively just refers to only calling `epoll_wait` at most
once.

Considering winit for example, this should have no effect since winit
will be calling `poll_events` in a loop with no assumption about how
concurrent events could potentially be batched.

Fixes: #170
@rib rib force-pushed the rib/pr/avoid-deprecated-poll-all branch from 83124dd to f08d7b3 Compare March 2, 2026 20:58
@rib
Copy link
Member Author

rib commented Mar 2, 2026

Ok, I've now tested with na-egui and agdk-egui and am satisfied that this change is backwards compatible.

@rib rib merged commit 4ff3580 into main Mar 2, 2026
7 checks passed
@rib rib deleted the rib/pr/avoid-deprecated-poll-all branch March 2, 2026 21:03
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.

ALooper_pollAll is marked deprecated by Android NDK

1 participant