3

I've seen a couple of times the following pattern people use when working with SurfaceView:

while(true) {
    try {
        renderThread.join();
        break;
    } catch (InterruptedException e) {
        // retry
    }
}

For example, here or here. Why do that? Especially given that nothing is actually interrupting the thread.

Community
  • 1
  • 1
Fixpoint
  • 9,619
  • 17
  • 59
  • 78
  • I think you can not be sure that your thread will not be interrupted in such multithreaded environment as Android. The meaning of the code is that the `SurfaceView` should always have a completed presentation, not mangled by unfinished drawing resulted from some external events (notifications, networking state changes etc). – Stan Jan 10 '13 at 19:39

0 Answers0