All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.oscim.utils.ThreadUtils Maven / Gradle / Ivy

Go to download

OpenGL vector map library written in Java - running on Android, iOS, Desktop and within the browser.

There is a newer version: 0.21.0
Show newest version
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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy