Android Gameloop Thread.join()挂起应用程序

时间:2011-03-21 18:55:33

标签: android multithreading loops frame-rate

嘿,我正在实现这里找到的游戏循环:http://obviam.net/index.php/the-android-game-loop/

我的问题是为什么有:

    boolean retry = true;
    while (retry) {
        try {
            thread.join();
            retry = false;
        } catch (InterruptedException e) {
            // try again shutting down the thread
        }
    }

在我的游戏视图的surfaceDestroyed()函数中挂起应用程序?

2 个答案:

答案 0 :(得分:2)

thread.join()将阻塞,直到您加入的主题完成。如果该线程永远不会完成,那么该函数将永远不会释放。

答案 1 :(得分:0)

因为thread.join()在线程完成之前阻塞了调用线程。

相关问题