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

Commit 3195ac45 authored by Matt Garnes's avatar Matt Garnes Committed by Gerrit Code Review
Browse files

Fix deadlock when reading shell output.

Change-Id: Ia38ac6c415506f21ffde5a4c3e658e810dea92da
(cherry picked from commit 2f7e43ce)
(cherry picked from commit 06c93489)
parent 14218979
Loading
Loading
Loading
Loading
+5 −18
Original line number Diff line number Diff line
@@ -53,10 +53,6 @@ public abstract class AsyncResultProgram
     */
    final List<Byte> mPartialDataType;
    final Object mSync = new Object();
    /**
     * @hide
     */
    final Object mTerminateSync = new Object();

    private boolean mCancelled;
    private OnCancelListener mOnCancelListener;
@@ -134,14 +130,11 @@ public abstract class AsyncResultProgram
            this.mWorkerThread.mAlive = false;
            this.mSync.notify();
        }
        synchronized (this.mTerminateSync) {
            if (this.mWorkerThread.isAlive()) {

        try {
                    this.mTerminateSync.wait();
                } catch (Exception e) {
                    /**NON BLOCK**/
                }
            }
            this.mWorkerThread.join();
        } catch (InterruptedException e) {
            // Ignore this.
        }

        //Notify end to command class
@@ -395,12 +388,6 @@ public abstract class AsyncResultProgram
                }
            } catch (Exception e) {
                /**NON BLOCK**/

            } finally {
                this.mAlive = false;
                synchronized (AsyncResultProgram.this.mTerminateSync) {
                    AsyncResultProgram.this.mTerminateSync.notify();
                }
            }
        }
    }