Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
am 46b5109: Merge "Safely handle interrupts during Thread.join()"
Browse files Browse the repository at this point in the history
* commit '46b51097b92900866ac5b25762f622d3ceb1be5d':
  Safely handle interrupts during Thread.join()
  • Loading branch information
pirama-arumuga-nainar authored and Android Git Automerger committed Oct 5, 2015
2 parents ee144b1 + 46b5109 commit c9390c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rs/java/android/renderscript/RenderScript.java
Expand Up @@ -1585,15 +1585,20 @@ private void helpDestroy() {
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();

Expand Down

0 comments on commit c9390c8

Please sign in to comment.