APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.utils

public Class PauseableThread

extends Thread
Class Inheritance

A 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.
Author
mzechner

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv boolean
pack-priv final Runnable
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
public
PauseableThread(Runnable
the runnable.
runnable
)

Constructs a new thread setting the runnable which will be called repeatedly in a loop.

Method Summary

Modifier and TypeMethod and Description
public boolean
isPaused()

Returns: whether this thread is paused or not

public void
onPause()

Pauses the thread.

public void
onResume()

Resumes the thread.

public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.

public void
stopThread()

Stops this thread

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadthreadIdtoStringyield

Field Detail

exitback to summary
pack-priv boolean exit
pausedback to summary
pack-priv boolean paused
runnableback to summary
pack-priv final Runnable runnable

Constructor Detail

PauseableThreadback to summary
public PauseableThread(Runnable runnable)

Constructs a new thread setting the runnable which will be called repeatedly in a loop.

Parameters
runnable:Runnable

the runnable.

Method Detail

isPausedback to summary
public boolean isPaused()
Returns:boolean

whether this thread is paused or not

onPauseback to summary
public void onPause()

Pauses the thread. This call is non-blocking

onResumeback to summary
public void onResume()

Resumes the thread. This call is non-blocking

runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

stopThreadback to summary
public void stopThread()

Stops this thread