Skip to content

Commit

Permalink
Merge "CMFM: Fix sync object" into cm-10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jruesga authored and Gerrit Code Review committed Jan 7, 2013
2 parents 870edd4 + 0f6534b commit 6e8dd09
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public abstract class AsyncResultProgram
* @hide
*/
final List<Byte> mPartialDataType;
private final Object mSync = new Object();
final Object mSync = new Object();
/**
* @hide
*/
Expand Down Expand Up @@ -106,7 +106,7 @@ public AsyncResultProgram(
* @hide
*/
public final void onRequestStartParsePartialResult() {
this.mWorkerThread = new AsyncResultProgramThread(this.mSync);
this.mWorkerThread = new AsyncResultProgramThread();
this.mWorkerThread.start();

//Notify start to command class
Expand All @@ -132,7 +132,7 @@ public final void onRequestEndParsePartialResult(boolean cancelled) {
}
synchronized (this.mTerminateSync) {
try {
this.mSync.wait();
this.mTerminateSync.wait();
} catch (Exception e) {
/**NON BLOCK**/
}
Expand Down Expand Up @@ -353,16 +353,12 @@ public boolean isExpectEnd() {
*/
private class AsyncResultProgramThread extends Thread {
boolean mAlive = true;
private final Object mSyncObj;

/**
* Constructor of <code>AsyncResultProgramThread</code>.
*
* @param sync The synchronized object
*/
AsyncResultProgramThread(Object sync) {
AsyncResultProgramThread() {
super();
this.mSyncObj = sync;
}

/**
Expand All @@ -373,8 +369,8 @@ public void run() {
try {
this.mAlive = true;
while (this.mAlive) {
synchronized (this.mSyncObj) {
this.mSyncObj.wait();
synchronized (AsyncResultProgram.this.mSync) {
AsyncResultProgram.this.mSync.wait();
while (AsyncResultProgram.this.mPartialData.size() > 0) {
if (!this.mAlive) {
return;
Expand Down

0 comments on commit 6e8dd09

Please sign in to comment.