public class LibgdxTaskExecutor extends java.lang.Object implements TaskExecutor
| Constructor and Description |
|---|
LibgdxTaskExecutor(int threads) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
void |
execute(java.lang.Runnable runnable)
Queues a
Runnable instance to be run on a separate thread |
int |
getTotalQueuedAsyncTasks()
Returns the current amount of tasks in the async queue
|
int |
getTotalQueuedFrameSpreadTasks()
Returns the current amount of
FrameSpreadTask in the frame spread queue |
TaskExecutor |
newExecutor(int threads)
Creates a new
TaskExecutor with the specified amount of threads |
void |
setMaxFrameTasksPerFrame(int max)
Sets the maximum number of
FrameSpreadTask instances to update per frame |
<T> AsyncResult<T> |
submit(java.util.concurrent.Callable<T> callable)
Submits a
Callable instance to be executed on a separate thread |
void |
submit(FrameSpreadTask task)
Submits a
FrameSpreadTask to be completed over several frames |
AsyncFuture |
submit(java.lang.Runnable runnable)
Submits a
Runnable instance to be executed on a separate thread |
void |
update(float delta)
Updates
FrameSpreadTask instances each frame. |
public TaskExecutor newExecutor(int threads)
TaskExecutorTaskExecutor with the specified amount of threadsnewExecutor in interface TaskExecutorthreads - The amount of threads in the pool, minimum 1TaskExecutor instancepublic void update(float delta)
TaskExecutorFrameSpreadTask instances each frame.
Note: This is called by mini2Dx and should not be called manually.update in interface TaskExecutordelta - The game delta timepublic void execute(java.lang.Runnable runnable)
TaskExecutorRunnable instance to be run on a separate threadexecute in interface TaskExecutorrunnable - The task to run on a separate threadpublic AsyncFuture submit(java.lang.Runnable runnable)
TaskExecutorRunnable instance to be executed on a separate threadsubmit in interface TaskExecutorrunnable - The task to run on a separate threadAsyncFuture instance that can be checked for task completionpublic <T> AsyncResult<T> submit(java.util.concurrent.Callable<T> callable)
TaskExecutorCallable instance to be executed on a separate threadsubmit in interface TaskExecutorT - The return typecallable - The task to run on a separate threadAsyncResult instance that can be checked for task completionpublic void submit(FrameSpreadTask task)
TaskExecutorFrameSpreadTask to be completed over several framessubmit in interface TaskExecutortask - The FrameSpreadTask to executepublic void setMaxFrameTasksPerFrame(int max)
TaskExecutorFrameSpreadTask instances to update per framesetMaxFrameTasksPerFrame in interface TaskExecutormax - The maximum number greater than 0public int getTotalQueuedAsyncTasks()
TaskExecutorgetTotalQueuedAsyncTasks in interface TaskExecutorpublic int getTotalQueuedFrameSpreadTasks()
TaskExecutorFrameSpreadTask in the frame spread queuegetTotalQueuedFrameSpreadTasks in interface TaskExecutorpublic void dispose()
dispose in interface org.mini2Dx.gdx.utils.Disposable