org.oscim.utils.ThreadUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vtm Show documentation
Show all versions of vtm Show documentation
OpenGL vector map library written in Java - running on Android, iOS, Desktop and within the browser.
package org.oscim.utils;
public class ThreadUtils {
private static Thread MAIN_THREAD;
public static void assertMainThread() {
if (MAIN_THREAD != Thread.currentThread())
throw new RuntimeException("Access from non-main thread!");
}
public static boolean isMainThread() {
return MAIN_THREAD == Thread.currentThread();
}
public static void init() {
MAIN_THREAD = Thread.currentThread();
}
}