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

Commit f8438a7d authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Fix race condition on exit."

parents ec8ae3ce a8bf9429
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -608,7 +608,7 @@ public class RenderScript {
            while(mRun) {
                rbuf[0] = 0;
                int msg = mRS.nContextGetMessage(mRS.mContext, rbuf, true);
                if (msg == 0) {
                if ((msg == 0) && mRun) {
                    // Can happen for two reasons
                    if (rbuf[0] > 0) {
                        // 1: Buffer needs to be enlarged.
@@ -661,6 +661,10 @@ public class RenderScript {
        validate();
        nContextDeinitToClient(mContext);
        mMessageThread.mRun = false;
        try {
            mMessageThread.join();
        } catch(InterruptedException e) {
        }

        nContextDestroy();
        mContext = 0;