Improve GLSurfaceView to avoid deadlocks and race conditions.
This is work towards fixing bug 2228262 Specific issues fixed by this change: + GLThread names now include the thread id, making it easier to tell one GLThread from another. + A private final static boolean LOG_THREADS can be set to true at compile time to print out thread-related trace information, helpful for debugging GLSurfaceView behavior. This static defaults to "false". + Changed calls to "notify" to "notifyAll" to make the code more robust in case more than two threads are blocked on the same monitor. + Add a GLThreadManager to help manage the transition to a new GLThread. Currently only one GLThread can be active in an address space. When the second thread starts up, the GLThreadManager helps the old GLThread to shut down, + Make sure we stop waiting for dead GLThreads. This is done by adding checks for a variable mDone being true to our monitor wait loops. And we use a "finally" clause at the end of GLThread.run() method to set mDone and notifyAll any wait loops.
Loading
Please register or sign in to comment