- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package com.helpshift.concurrency;
|
|
|
|
import com.helpshift.log.HSLogger;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class NotifyingRunnable implements Runnable {
|
|
public final Runnable runnable;
|
|
public final Object syncLock = new Object();
|
|
public AtomicBoolean isFinished = new AtomicBoolean(false);
|
|
|
|
public NotifyingRunnable(Runnable runnable) {
|
|
this.runnable = runnable;
|
|
}
|
|
|
|
public void waitForCompletion() {
|
|
synchronized (this.syncLock) {
|
|
while (!this.isFinished.get()) {
|
|
try {
|
|
this.syncLock.wait();
|
|
} catch (InterruptedException e) {
|
|
HSLogger.d("NotifyingRunnable", "Exception in NotifyingRunnable", e);
|
|
Thread.currentThread().interrupt();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
synchronized (this.syncLock) {
|
|
try {
|
|
try {
|
|
this.runnable.run();
|
|
} finally {
|
|
this.isFinished.set(true);
|
|
this.syncLock.notifyAll();
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
}
|