Rabbit-R1/switch port/java/sources/io/sentry/util/thread/MainThreadChecker.java
2024-05-21 17:08:36 -04:00

37 lines
1.1 KiB
Java

package io.sentry.util.thread;
import io.sentry.protocol.SentryThread;
/* loaded from: classes3.dex */
public final class MainThreadChecker implements IMainThreadChecker {
private static final long mainThreadId = Thread.currentThread().getId();
private static final MainThreadChecker instance = new MainThreadChecker();
public static MainThreadChecker getInstance() {
return instance;
}
@Override // io.sentry.util.thread.IMainThreadChecker
public boolean isMainThread(long j) {
return mainThreadId == j;
}
private MainThreadChecker() {
}
@Override // io.sentry.util.thread.IMainThreadChecker
public boolean isMainThread(Thread thread) {
return isMainThread(thread.getId());
}
@Override // io.sentry.util.thread.IMainThreadChecker
public boolean isMainThread() {
return isMainThread(Thread.currentThread());
}
@Override // io.sentry.util.thread.IMainThreadChecker
public boolean isMainThread(SentryThread sentryThread) {
Long id = sentryThread.getId();
return id != null && isMainThread(id.longValue());
}
}