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

Commit 46b51097 authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar Committed by Gerrit Code Review
Browse files

Merge "Safely handle interrupts during Thread.join()"

parents bd57dac5 83461d73
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1576,15 +1576,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) {
                    interrupted = true;
                }
            }
            if (interrupted) {
                Log.v(LOG_TAG, "Interrupted during wait for MessageThread to join");
                Thread.currentThread().interrupt();
            }

            nContextDestroy();