am c9390c8b: am 46b51097: Merge "Safely handle interrupts during Thread.join()"

* commit 'c9390c8baf0a41633c176d6d9a2d7e5d0c61c387':
  Safely handle interrupts during Thread.join()
This commit is contained in:
Pirama Arumuga Nainar
2015-10-05 23:39:04 +00:00
committed by Android Git Automerger

View File

@@ -1585,15 +1585,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();