Closed DanAlbert closed 5 months ago
@jreck says this isn't actually a good fix. The problem is present when calling pollOnce
in a loop as I have here as well. The nuance is that this sample doesn't have the bug at all, because the problem only happens when ALooper_wake
is used, and this sample doesn't do that. OTOH, this sample doesn't do that mainly because it's trivial. Anything built with this sample as its base likely would.
The better fix is to migrate to AChoreographer
. I'll close this and upload a new PR that does that.
The
pollAll
API was removed because it can't be used safely. The recommendation is to replace existing calls topollAll
withpollOnce
with an explicit loop.There are quite a few other samples that are doing this. Fixing one to start so I can check with someone that understands the
pollAll
bug so I don't accidentally copy the same bug, then I'll fix the others.https://github.com/android/ndk-samples/issues/999