29 lines
715 B
Java
29 lines
715 B
Java
package com.afunx.ble.blelitelib.operation;
|
|
|
|
import java.util.concurrent.Semaphore;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class BleOperationLock {
|
|
private final Semaphore mSemaphore = new Semaphore(0);
|
|
private volatile boolean mIsNotified = false;
|
|
|
|
boolean isNotified() {
|
|
return this.mIsNotified;
|
|
}
|
|
|
|
void notifyLock() {
|
|
this.mIsNotified = true;
|
|
this.mSemaphore.release();
|
|
}
|
|
|
|
void waitLock(long j) {
|
|
try {
|
|
this.mSemaphore.tryAcquire(1, j, TimeUnit.MILLISECONDS);
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
Thread.currentThread().interrupt();
|
|
}
|
|
}
|
|
}
|