Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f25ce77 authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar
Browse files

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
parent 86e67d70
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1574,10 +1574,17 @@ public class RenderScript {

            nContextDeinitToClient(mContext);
            mMessageThread.mRun = false;

            // 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();