Package com.badlogic.gdx.utils
Class PauseableThread
- java.lang.Object
-
- java.lang.Thread
-
- com.badlogic.gdx.utils.PauseableThread
-
- All Implemented Interfaces:
java.lang.Runnable
public class PauseableThread extends java.lang.ThreadA pausable thread. The runnable must not execute an infinite loop but should return control to the thread as often as possible so that the thread can actually pause.
-
-
Constructor Summary
Constructors Constructor Description PauseableThread(java.lang.Runnable runnable)Constructs a new thread setting the runnable which will be called repeatedly in a loop.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisPaused()voidonPause()Pauses the thread.voidonResume()Resumes the thread.voidrun()voidstopThread()Stops this thread-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
onPause
public void onPause()
Pauses the thread. This call is non-blocking
-
onResume
public void onResume()
Resumes the thread. This call is non-blocking
-
isPaused
public boolean isPaused()
- Returns:
- whether this thread is paused or not
-
stopThread
public void stopThread()
Stops this thread
-
-