diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-10-02 12:06:10 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-10-08 20:13:50 -0700 |
commit | 93db3d4bfd0062024a0cc05623e7e84df7313d86 (patch) | |
tree | cfd2a59982eb4aaa63e3062aa497bc97cac44e87 /rs/java | |
parent | 29433f701f6722e1f175dd3b735ed025309907b0 (diff) | |
download | frameworks_base-93db3d4bfd0062024a0cc05623e7e84df7313d86.zip frameworks_base-93db3d4bfd0062024a0cc05623e7e84df7313d86.tar.gz frameworks_base-93db3d4bfd0062024a0cc05623e7e84df7313d86.tar.bz2 |
Retry if interrupted before mMessageThread has joined
Bug: 24342101
If interrupted during mMessageThread.join(), retry the join instead of
assuming the thread has joined and continuing. Continuing to destroy
the context will cause a segfault when the message thread attempts to
use the destroyed context.
Change-Id: I3213091a0e996449bceb403dffca3063786d5a65
(cherry picked from commit 2f25ce7753f7f1f6a0cc549a0df0082286bd5f85)
Diffstat (limited to 'rs/java')
-rw-r--r-- | rs/java/android/renderscript/RenderScript.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 8b1a032..62ddc39 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -1557,9 +1557,16 @@ public class RenderScript { nContextDeinitToClient(mContext); mMessageThread.mRun = false; - try { - mMessageThread.join(); - } catch(InterruptedException e) { + + // Wait for mMessageThread to join. Try in a loop, in case this thread gets interrupted + // during the wait. + boolean hasJoined = false; + while (!hasJoined) { + try { + mMessageThread.join(); + hasJoined = true; + } catch(InterruptedException e) { + } } nContextDestroy(); |