public interface SchedulingContext
The interface specifies two methods: registerTicks(int)
and shouldPause()
.
The former is used by an ExecutionContext
to register ticks spent in executing
a Lua program; the latter is used by ExecutionContexts to determine whether the execution
should be paused.
For basic implementations of this interface, see the utility class
SchedulingContexts
.
Modifier and Type | Method and Description |
---|---|
void |
registerTicks(int ticks)
Informs the scheduler that the current task is about to consume or has consumed
ticks virtual ticks. |
boolean |
shouldPause()
Polls the scheduler, returning
true if the current task should be paused. |
void registerTicks(int ticks)
ticks
virtual ticks.
This method only registers ticks
with the scheduler, irrespective
of whether the current task should be paused. In order to check whether execution
should be paused, use shouldPause()
.
The behaviour of this method is undefined if ticks
is negative.
Note: this method is not meant to be used directly by Lua programs, but rather
to be called by the implementations of ExecutionContext.registerTicks(int)
.
ticks
- number of ticks to be registered with the scheduler, must not be negativeboolean shouldPause()
true
if the current task should be paused.
Note: this method is not meant to be used directly by Lua programs, but rather
to be called by the implementations of ExecutionContext.pauseIfRequested()
.
true
if the current task should be pausedCopyright © 2016. All rights reserved.