Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
  • Loading branch information
bofeng-song committed Dec 12, 2024
1 parent cba08b7 commit 11a2357
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions native/cocos/platform/android/AndroidPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,22 +852,12 @@ int32_t AndroidPlatform::loop() {
struct android_poll_source *source;

// suspend thread while _loopTimeOut set to -1
while (true) {
int pollResult = ALooper_pollOnce(_loopTimeOut, nullptr, nullptr,
reinterpret_cast<void **>(&source));

// Process events if any
if (pollResult == ALOOPER_POLL_ERROR) {
CC_LOG_ERROR("ALooper_pollOnce returned and error");
break;
}
while (ALooper_pollOnce(_loopTimeOut, nullptr, nullptr,
reinterpret_cast<void **>(&source)) >= 0) {
// Process events
if (source != nullptr) {
source->process(_app, source);
}
if (pollResult == ALOOPER_POLL_TIMEOUT) {
break;
}


// Exit the game loop when the Activity is destroyed
if (_app->destroyRequested) {
Expand Down

0 comments on commit 11a2357

Please sign in to comment.