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 2f25ce7753)
This commit is contained in:
@@ -1557,9 +1557,16 @@ public class RenderScript {
|
|||||||
|
|
||||||
nContextDeinitToClient(mContext);
|
nContextDeinitToClient(mContext);
|
||||||
mMessageThread.mRun = false;
|
mMessageThread.mRun = false;
|
||||||
try {
|
|
||||||
mMessageThread.join();
|
// Wait for mMessageThread to join. Try in a loop, in case this thread gets interrupted
|
||||||
} catch(InterruptedException e) {
|
// during the wait.
|
||||||
|
boolean hasJoined = false;
|
||||||
|
while (!hasJoined) {
|
||||||
|
try {
|
||||||
|
mMessageThread.join();
|
||||||
|
hasJoined = true;
|
||||||
|
} catch(InterruptedException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nContextDestroy();
|
nContextDestroy();
|
||||||
|
|||||||
Reference in New Issue
Block a user