Package com.dkt.graphics.utils
Class PThread
- java.lang.Object
-
- java.lang.Thread
-
- com.dkt.graphics.utils.PThread
-
- All Implemented Interfaces:
java.lang.Runnable
public abstract class PThread extends java.lang.Thread
-
-
Constructor Summary
Constructors Constructor Description PThread()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkPause()
This method should be called within the main run loop.boolean
pause()
Pauses the current threadabstract void
run()
void
unpause()
Resumes the current thread-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
pause
public final boolean pause()
Pauses the current thread- Returns:
true
if the thread was successfully paused andfalse
if the thread was already paused
-
unpause
public final void unpause()
Resumes the current thread
-
checkPause
protected final void checkPause()
This method should be called within the main run loop. If this isn't called then the thread will not be paused. An example of an implementation could be:class MyThread extends PThread { @Override public void run() { //Init code while(!interrupted() && condition){ checkPause(); //Loop code } //End code } }
-
run
public abstract void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
-