am a186456f: Safely handle interrupts during Thread.join()
* commit 'a186456ff58a6091603956b6788565a273a29485': Safely handle interrupts during Thread.join()
This commit is contained in:
committed by
Android Git Automerger
commit
456a451668
@@ -1559,15 +1559,20 @@ public class RenderScript {
|
||||
mMessageThread.mRun = false;
|
||||
|
||||
// Wait for mMessageThread to join. Try in a loop, in case this thread gets interrupted
|
||||
// during the wait.
|
||||
boolean hasJoined = false;
|
||||
// during the wait. If interrupted, set the "interrupted" status of the current thread.
|
||||
boolean hasJoined = false, interrupted = false;
|
||||
while (!hasJoined) {
|
||||
try {
|
||||
mMessageThread.join();
|
||||
hasJoined = true;
|
||||
} catch(InterruptedException e) {
|
||||
} catch (InterruptedException e) {
|
||||
interrupted = true;
|
||||
}
|
||||
}
|
||||
if (interrupted) {
|
||||
Log.v(LOG_TAG, "Interrupted during wait for MessageThread to join");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
nContextDestroy();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user