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

Cherry pick PR #3027: [Android] Fix CPU spinning of StarboardMain. #3045

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

cobalt-github-releaser-bot
Copy link
Collaborator

Refer to the original PR: #3027

An integer overflow in a downconversion resulted in a negative timeout being used for the ALooper_pollAll call.

This fixes that, and adds a ALooper_wake when a non-system event is injectet.

Change handle_system_events_ from bool to atomic_bool to make it thread safe. Replace deprecated ALooper_pollAll with the suggested ALooper_pollOnce (*1) to avoid swallowing of ALooper_wake calls.

Left the kMaxPollingTimeMillisecond workaround for swallowed wake calls in place, but increased the timeout to one second to minimize CPU usage.

*1: https://developer.android.com/ndk/reference/group/looper#group___looper_1gab2585652f8ae2e2444979194ebe32aaf

b/335901937

An integer overflow in a downconversion resulted in a negative timeout
being used for the ALooper_pollAll call.

This fixes that, and adds a ALooper_wake when a non-system event is
injectet.

b/335901937

(cherry picked from commit ed27e83)
@jellefoks jellefoks merged commit 2efef44 into 25.lts.1+ Apr 22, 2024
288 checks passed
@jellefoks jellefoks deleted the cherry-pick-25.lts.1+-3027 branch April 22, 2024 20:42
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.

2 participants