libgdx API

com.badlogic.gdx.utils
Class PauseableThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.badlogic.gdx.utils.PauseableThread
All Implemented Interfaces:
java.lang.Runnable

public class PauseableThread
extends java.lang.Thread

A pausable thread. The runnable must not execute an inifite loop but should return control to the thread as often as possible so that the thread can actually pause.

Author:
mzechner

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PauseableThread(java.lang.Runnable runnable)
          Constructs a new thread setting the runnable which will be called repeatadly in a loop.
 
Method Summary
 boolean isPaused()
           
 void onPause()
          Pauses the thread.
 void onResume()
          Resumes the thread.
 void run()
           
 void stopThread()
          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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PauseableThread

public PauseableThread(java.lang.Runnable runnable)
Constructs a new thread setting the runnable which will be called repeatadly in a loop.

Parameters:
runnable - the runnable.
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.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


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)